Getting Started With Angular 2 Modules (Using The @NgModule Decorator)

With RC5 the Angular team introduces the concept of modules. Angular 2 Modules help to organize your web application into blocks of functionality.

In this video you’ll get a comprehensive introduction to the Angular 2 Modules concept and you’ll learn how to set up a new Angular 2 application using @NgModule.

Advantages of Modularity in Angular 2

  • Application can be organized in smaller blocks of functionality
  • Easy to extend application by including modules (e.g. for external libraries)
  • Angular 2 offers standard libraries like: FormsModule, HttpModule, RouterModule
  • Angular Modules consolidate components, directives and pipes into blocks of functionality

The @NgModule Decorator

  • An Angular 2 Module is a class decorated with @NgModule
  • @NgModule is used to attach module metadata to the class
  • Metadata is used to declare which components, directives and pipes belong to that module



Using and writing about best practices and latest technologies in web design & development is my passion.