Re:AngularJS: Factory vs. Service vs. Provider
by spion on Sunday May 04, 2014 @09:59PM
(#7696670)
Because .factory is slightly more general (can return non-objects), and it can't be called .service because backward compatibility.
[ Parent
| on HN ]
Re:AngularJS: Factory vs. Service vs. Provider
by jonny_eh on Sunday May 04, 2014 @10:34PM
(#7696742)
The article seems to be down for me. Can you give an example of a case where a .service won't cut it but a . Factory would?
Re:AngularJS: Factory vs. Service vs. Provider
by minznerjosh on Sunday May 04, 2014 @10:44PM
(#7696759)
.factory('$timeout', function($window) {
var $timeout = $window.setTimeout;
return $timeout;
}).service('$timeout', function($window) {
// $timeout is a function, not an normal object. Why would I use a constructor
//function to provide it?
});