Installing the package
First of all, we need to install the Angular Material Design package. That is relatively simple using the Angular CLI:
ng new chap10 cd chap10 npm install --save @angular/material npm install --save @angular/animations npm install --save hammerjs
We install two packages here, @angular/material
and the hammerjs
packages. The first one includes in our app, the Material Design modules, which we will use in the next section. The second package, however, is a JavaScript implementation of touch movements. Some Material Design components such as slider
depend on hammerjs
.
Then, as per the NgModule
specification, we can import MaterialModule
as follows:
//src/app/app.module.ts import { MaterialModule } from '@angular/material'; import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; import { AppComponent } from './app.component...