Importing What we Need

Before we use an external function or class, we define where to find it. We do that with:
+ import statement
+ import allows us to use exported members from external ES module
+ import from third party library, our own ES modules or from Angular

We can import from Angular because it is modular. There is a collection of library modules. Each library is itself a module made up of several related feature module. Some of the Angular library module are:
+ @angular/core
+ @angular/animate
+ @angular/http
+ @angular/router

You can view more angular library packages at:

Completed Component
import { Component } from '@angular/core';

  selector: 'pm-root',
  template: `
    <div>My First Component</div>
export class AppComponent {
    pageTitle: string = 'Acme Product Management';

'import' is import keyword
'Component' is member name
'@angular/core' is angular library / module name

Share this

Related Posts