I want to pass a domain name as parameter with $resource request. I tried this but it doesn't work. I don't see why. Any clue ? It outputs http://:url/ instead of the variable I'm trying to pass.
edit: the variable :url passes if I do something like this : http://adomain.com/:url
Here's my code :
My factory :
angular.module('myApp')
.factory('LoadingContent', function LoadingContentFactory($resource) {
return $resource('http://:url/wp-json/posts/?type[]=:type&filter[posts_per_page]=50&filter[order]=DESC', {type: '@type',url: '@url'}, {'get': {method: 'GET', isArray: true, params: {type: '@type',url: '@url'} }});
});
My function :
LoadingContent.get({
url : $scope.selectedCompany.URL,
type : $scope.selectedCompany.type,
})
.$promise.then(
function(data){
$scope.articles = data;
openInfoModals.closeModal();
}
);
Problem solved : The problem comes from the version of angular-resource#1.4.5. I went back to 1.4.3 version and it works.
If anyone has a solution to make it work with 1.4.5, he's welcome.