Combining resources in AngularJS
问题 I have a RESTful API that provides me with employees and departments. In my AngularJS app, I need to know the employee and the departments the employee belongs to. I have defined two factory services for that: angular.module('myApp.services', []) .factory('Employee', function ($resource) { return $resource ('/api/employees/:id', { id: '@id' }); }) .factory('Department', function ($resource) { return $resource ('/api/departments/:id', { id: '@id' }); }) ; In the controller, I call: $scope