Angular Libraries

Go back to Tutorial

Angular ships as a collection of JavaScript modules. You can think of them as library modules. Each Angular library name begins with the @angular prefix. Install them with the npm package manager and import parts of them with JavaScript import statements.

For example, import Angular’s Component decorator from the @angular/core library like this:

import { Component } from ‘@angular/core’;

You also import NgModules from Angular libraries using JavaScript import statements:

import { BrowserModule } from ‘@angular/platform-browser’;

In the example of the simple root module above, the application module needs material from within the BrowserModule. To access that material, add it to the @NgModule metadata imports like this.

imports:      [ BrowserModule ],

In this way you’re using both the Angular and JavaScript module systems together. Although it’s easy to confuse the two systems, which share the common vocabulary of “imports” and “exports”, you will become familiar with the different contexts in which they are used.

 

Go back to Tutorial

Get industry recognized certification – Contact us

Menu