The general practice is to put it in a service, which exists in a file 
named "services.js".  I have my api for many assets all in one service and 
the file contains many services in addition to the API $resource.  If you 
want it to be somewhat modular to share between different angular apps, 
then put it in it's own module and call the file whatever you want.  A 
simple name like AssetService is fine.

angular.module('AssetApi', []).
  service('api', ['$http','$resource',
        function($http, $resource){
             var Assets = $resource('/api/assets',{},{ get: { method: 'get' 
} })
        });

            

On Friday, February 28, 2014 12:14:50 AM UTC-7, Miguel Aramis Ramírez wrote:
>
> Let's say I have an API that knows how to update/delete/create an Asset... 
> What is the best practice? To have a single file AssetServices? Or have 
> UpdateAssetService/DeleteAssetService/CreateAssetService?
>
> Thanks!
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to