Skip to content

Instantly share code, notes, and snippets.

@karthickvkumar
Created June 26, 2017 08:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karthickvkumar/f443d20f86214191d38d9b1c73d2cc5d to your computer and use it in GitHub Desktop.
Save karthickvkumar/f443d20f86214191d38d9b1c73d2cc5d to your computer and use it in GitHub Desktop.
Factory vs Service
//service
app.service('MyService', function () {
this.sayHello = function () {
console.log('hello');
};
});
//factory
app.factory('MyService', function () {
return {
sayHello: function () {
console.log('hello');
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment