Created
June 26, 2017 08:10
-
-
Save karthickvkumar/f443d20f86214191d38d9b1c73d2cc5d to your computer and use it in GitHub Desktop.
Factory vs Service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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