I have written a service in AngularJS, but I can\'t get it to work with the angular-seed way of doing things.
The controller code is as follows:
/*fu
You need to define the Photo
service:
angular.module('myApp.controllers', [])
.service('Photo', ['$log', function ($log) {
return {
query: function() {
// the query code here.
}
};
}])
.controller('PhotoCtrl', ['$scope', 'Photo', function ($scope, Photo) {
$scope.photos = Photo.query();
}])
.controller('MyCtrl2', [function() {
}]);
A couple of references:
In the above sample code I used parameters aliasing, which I suggest in order to avoid issues when minifying your code.
See also an example here: AngularJS multiple uses of Controller and rootScope
And a Plunker here: http://plnkr.co/edit/Bzjruq