What is the difference between Factory, Service and Provider?
Answer / chaitanya
Factory - A factory is a simple function which allows you to add some logic before creating the object. It returns the created object.
Service - A service is a constructor function which creates the object using new keyword. You can add properties and functions to a service object by using this keyword. Unlike factory, it doesn’t return anything.
Provider - A provider is used to create a configurable service object. It returns value by using $get() function.
| Is This Answer Correct ? | 0 Yes | 0 No |
Should I use angular?
What is import array in angular 2?
What is single page application means?
Do you know scope in angular?
What’s the advantage of using form builder?
Why is it called bearer token?
What is tree shaking?
What is traceur compiler? Why in angular 2?
How to debug the $rootscope object of angularjs when in the browser?
What's new in angular 6?
How $location is different from window.location in angularjs?
How do you use flexbox?