AngularJS module

From Wiki @ Karl Jones dot com
Revision as of 12:09, 22 February 2017 by Karl Jones (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

In AngularJS, modules help organize an application into cohesive blocks of functionality.

An Angular module is a class decorated with the @NgModule decorator function.

@NgModule takes a metadata object that tells Angular how to compile and run module code. It identifies the module's own components, directives and pipes, making some of them public so external components can use them. It may add service providers to the application dependency injectors.

ES5 JavaScript does not have a native module system. There are several popular third party module systems available.

Module interaction

In Angular apps, modules reference other modules using the app object.

When another module needs to refer to AppComponent, it gets it from app.AppComponent.

See also

External links