AngularJS Module Loading

Source: Internet
Author: User

The Angularjs module can be configured on its own before it is loaded and executed. We can apply different logical groups during the load phase of the app.
During the load phase of the module, Angularjs configures the module during provider registration and configuration. Throughout the ANGULARJS workflow, this phase is the only part that can be modified before the app is launched.

Angular.module (' myApp ', [])
. config (function ($provide) {
});

Use the syntax sugar of the config () function and execute it during the configuration phase. For example, when we create a service or instruction on top of a module:

Angular.module ('myApp', []). Factory ('MyFactory', function () {varService = {}; returnService; }). directive ('mydirective', function () {return{Template:'<button>click me</button>'            }    })

Angularjs will execute these auxiliary functions at compile time. They are functionally equivalent to the following notation:

Angular.module ('myApp', []). config (function ($provide, $compileProvider) {$provide. Factory ('MyFactory', function () {varService = {}; returnService;            }); $compileProvider. Directive ('mydirective', function () {return{Template:'<button>click me</button>'                }; });});

Angularjs executes them in the order in which these functions are written and registered.

AngularJS Module Loading

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.