1). Factories are functions that return the object, while services are constructor functions of the object which are instantiated with the
angular.module('app').factory('SomeService', function() { return { someFunction: function() {} }; });
angular.module('app').service('SomeService', function() { this.someFunction = function() {}; });
new
keyword.angular.module('app').factory('SomeService', function() { return { someFunction: function() {} }; });
angular.module('app').service('SomeService', function() { this.someFunction = function() {}; });
No comments:
Post a Comment