All the web applications that we build uses Object that collaborate to get things done. These objects need to be instantiated.In angular, these objects are instantiated and wired by injector service.
Injector creates two types of objects - services and specialize objects.
Services objects are those API's that are defined by developer.
Specialized objects are defined specifically by Angular API, for e.g. controllers, directives, filters or animations.
Now, we have to specify that how to create these objects. There are five ways to create these objects.
* Value * Factory * Services * Constant and last but not the least Provider.
So, Lets discuss all one by one. I'll start by provider first.
Provider: Provider is the core of all type. All other are just the extension over it.
Provider is the implementation of $get method. This method is same like as we use in Factory.
Provider is used where we set the application-wide configuration that must be instantiated before the application start.
When angular application is going to bootstrap, before creating all the services, angular instantiates all providers.
Provider's are accessible during configuration phase, because services are not accessible at that time.
After completion of configuration phase, interaction with provider is not allowed and service instantiation process gets started.
Injector creates two types of objects - services and specialize objects.
Services objects are those API's that are defined by developer.
Specialized objects are defined specifically by Angular API, for e.g. controllers, directives, filters or animations.
Now, we have to specify that how to create these objects. There are five ways to create these objects.
* Value * Factory * Services * Constant and last but not the least Provider.
So, Lets discuss all one by one. I'll start by provider first.
Provider: Provider is the core of all type. All other are just the extension over it.
Provider is the implementation of $get method. This method is same like as we use in Factory.
Provider is used where we set the application-wide configuration that must be instantiated before the application start.
When angular application is going to bootstrap, before creating all the services, angular instantiates all providers.
Provider's are accessible during configuration phase, because services are not accessible at that time.
After completion of configuration phase, interaction with provider is not allowed and service instantiation process gets started.
No comments:
Post a Comment