Angular. Module
Angular module Configuration interface.
Method :
Provider (Name,providertype);
Name: Service names.
ProviderType: Creates a constructor for an instance of a service.
Factory (Name,providerfunction);
Name: Service names.
Providerfunction: A function that creates an instance of the service.
Service (Name,constructor);
Name: Service names.
Constructor: A constructor that will be instantiated.
Value (Name,object);
Name: Service names.
Object: The service instance object.
Constant (Name,object);
Name: constant names.
Object: Constant value.
Animation (name,animationfactory);
Note: Animation only works if the Nganimate module is injected.
Defines an animation that can be used later in the $animate service or in instructions that inject this service.
Name: Animated names.
Animationfactory: The factory function that creates the animation.
Filter (name,filterfactory);
Name: Filter names.
Filterfactory: A factory function that creates an instance of a filter.
Controller (Name,constructor);
Name: Controller names.
Constructor: Controller constructor.
Directive (name,directivefactory);
Name: the directive names.
Directivefactory: Instruction Constructor.
Config (CONFIGFN);
Use this method to register the actions that need to be performed when the module is loaded.
CONFIGFN: Executes this function when the module is loaded. It is more practical when the service is configured.
Run (INITIALIZATIONFN);
Use this method to register actions that need to be performed after all the modules have been injected.
INITIALIZATIONFN: Executes the function after the injection is created. It is useful when the application is initialized.
Using code:
Angular.module ("Demo", []). Provider ("Demoprovider", ["dependency",function(dependency) {//Your code}]). Factory ("Demofactory", ["dependency",function(dependency) {//Your code}]). Service ("Demoservice", ["dependency",function(dependency) {//Your code}]). Value ("Demovalue").,{//Your object}). Constant ("Democonstant",{//Your object}). Animation (". Demoanimationname", ["dependency",function(dependency) {//Your code}]). Filter ("Demofilter", ["dependency",function(dependency) {//Your code}]). Controller ("Democtrl", ["dependency",function (dependency) { //YouCode }]). directive ("demodirctive", ["dependency",function ( Dependency) { //YouCode }]). config (["dependency",function(dependency) { //Your code }]). Run (["dependency",function(dependency) { //Your Code}])
These are the configuration of the module, such as writing their own controller, write their own service, or write config configuration What, here feel there is nothing specific to the introduction, according to their own projects to write these configurations can be ...
Angular--Angular. Module