Services in AngularJS -


i'm learning angularjs , i've little problem services. official tutorial gives example custom services rest :

angular.module('phonecatservices', ['ngresource']).     factory('phone', function($resource){         return $resource('phones/:phoneid.json', {}, {             query: {method:'get', params:{phoneid:'phones'}, isarray:true}         });     }); 

so made same code different names/url , works.

i pass parameter service (an id in url). tried use $routeparams in didn't work. found other way declare several function in same service, made :

factory('article', function($resource) {     return {         getlist: function(categoryid) {                 return $resource('http://...', {                     query: {method:'get', isarray:true}                 });             }         }     }) 

but doesn't work rest call (with return 'hello' example, it's ok).

do know how ?

thank !

it sounds not passing in parameter query function.

angular.module('article', ['ngresource']).     factory('phone', function($resource){         return return $resource('http://.../:articleid', {                 query: {method:'get', isarray:true}             });     }); }); 

and in controller.

article.query({   articleid : somevar }); 

Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -