You can update the service to return a hash of resources, and not one:
angular.module('myApp.services', ['ngResource']). factory("geoProvider", function($resource) { return { states: $resource('../data/states.json', {}, { query: { method: 'GET', params: {}, isArray: false } }), countries: $resource('../data/countries.json', {}, { query: { method: 'GET', params: {}, isArray: false } }) }; });
You can use it by adding .query() at the end, your function name, i.e. geoProvider.states.query() and geoProvider.countries.query() and myApp.services should be entered into your controller, then enter the geoProvider service in the controller itself, ok.
Dmitry Evseev Jun 18 '13 at 7:57 2013-06-18 07:57
source share