Angular--Angular. Module

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.