Let's suppose I have a simple service:
angular.module('myModule')
.factory('myService', ['$http', function($http) {
return $http.get('/something');
}]);
Now whenever I inject the service into a controller, the router waits for the promise to resolve before changing the route, which is exactly what I want.
However, there doesn't seem to then be a way to return other data from the service. What if the service needs to also provide some methods? How can I do this while still maintaining the dependency behavior described above?
Aucun commentaire:
Enregistrer un commentaire