NgModule Properties in Angular 2


NgModule is a decorator function that takes a single metadata object whose properties describe the module. The most important properties are:

declarations – the view classes that belong to this module. Angular has three kinds of view classes: components, directives, and pipes.
exports – the subset of declarations that should be visible and usable in the component templates of other modules.
imports – other modules whose exported classes are needed by component templates declared in this module.
providers – creators of services that this module contributes to the global collection of services; they become accessible in all parts of the app.
bootstrap – the main application view, called the root component, that hosts all other app views. Only the root module should set this bootstrap property.

Source: https://angular.io/

Components of Angular 2


Below are the major  components of Angular 2

Modules − This is used to break up the application into logical pieces of code. Each piece of code or module is designed to perform a single task.

Component − This can be used to bring the modules together.

Templates − This is used to define the views of an Angular JS application.

Metadata − This can be used to add more data to an Angular JS class.

Service − This is used to create components which can be shared across the entire application.

 

Angular 2 Features


Angular 2 is a opensource javascript framework developed by developers at google. This framework is used to build the single page applications. Angular 2 has been built by considering the difficulties faced in Angular 1 and Angular 2 removes the obstucles in building single page applications.

Blow are the special features of Angular 2:

Components − Angular 2 is a componenent based framework where as Angular 1 is Controller based framework. Components help to build the applications into many modules. This helps in better maintaining the application over a period of time.

TypeScript − Angular 2 is based on TypeScript(a language for application scale JavaScript development). This is a superset of JavaScript that compiles to clean JavaScript output.

Services − Services are a set of code that can be shared by different components of an application. So for example if you had a data component that picked data from a database, you could have it as a shared service that could be used across multiple applications.