-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Integration with AngularMaterial2
Jakob Bussas edited this page Jun 12, 2018
·
23 revisions
Quick guide to integrating Angular Material
An example can be found here.
npm install --save @angular/material @angular/cdk web-animations-js hammerjs
this.NPM_DEPENDENCIES = [
...this.NPM_DEPENDENCIES,
/* Select a pre-built Material theme */
{src: '@angular/material/prebuilt-themes/indigo-pink.css', inject: true},
/* Polyfill for unsupported browsers */
{src: 'web-animations-js/web-animations.min.js', inject: 'shims'},
/* For some gestures */
{src: 'hammerjs/hammer.js', inject: 'libs'},
];
const additionalPackages: ExtendPackages[] = [
{
name: '@angular/material',
path: 'node_modules/@angular/material/bundles/material.umd.js'
},
{
name: '@angular/cdk',
path: 'node_modules/@angular/cdk/bundles/cdk.umd.js'
},
{
name: '@angular/cdk/a11y',
path: 'node_modules/@angular/cdk/bundles/cdk-a11y.umd.js'
},
{
name: '@angular/cdk/accordion',
path: 'node_modules/@angular/cdk/bundles/cdk-accordion.umd.js'
},
{
name: '@angular/cdk/bidi',
path: 'node_modules/@angular/cdk/bundles/cdk-bidi.umd.js'
},
{
name: '@angular/cdk/coercion',
path: 'node_modules/@angular/cdk/bundles/cdk-coercion.umd.js'
},
{
name: '@angular/cdk/collections',
path: 'node_modules/@angular/cdk/bundles/cdk-collections.umd.js'
},
{
name: '@angular/cdk/keycodes',
path: 'node_modules/@angular/cdk/bundles/cdk-keycodes.umd.js'
},
{
name: '@angular/cdk/layout',
path: 'node_modules/@angular/cdk/bundles/cdk-layout.umd.js'
},
{
name: '@angular/cdk/observers',
path: 'node_modules/@angular/cdk/bundles/cdk-observers.umd.js'
},
{
name: '@angular/cdk/overlay',
path: 'node_modules/@angular/cdk/bundles/cdk-overlay.umd.js'
},
{
name: '@angular/cdk/platform',
path: 'node_modules/@angular/cdk/bundles/cdk-platform.umd.js'
},
{
name: '@angular/cdk/portal',
path: 'node_modules/@angular/cdk/bundles/cdk-portal.umd.js'
},
{
name: '@angular/cdk/scrolling',
path: 'node_modules/@angular/cdk/bundles/cdk-scrolling.umd.js'
},
{
name: '@angular/cdk/stepper',
path: 'node_modules/@angular/cdk/bundles/cdk-stepper.umd.js'
},
{
name: '@angular/cdk/table',
path: 'node_modules/@angular/cdk/bundles/cdk-table.umd.js'
},
{
name: '@angular/cdk/text-field',
path: 'node_modules/@angular/cdk/bundles/cdk-text-field.umd.js'
},
{
name: '@angular/cdk/tree',
path: 'node_modules/@angular/cdk/bundles/cdk-tree.umd.js'
}
];
this.addPackagesBundles(additionalPackages);
- Add
import { MatToolbarModule } from '@angular/material';
inabout.module.ts
- Add
MatToolbarModule
to NgModule imports inabout.module.ts
- Add HTML element:
<mat-toolbar color="primary">My App</mat-toolbar>
inabout.html
- Fix tests: add
MaterialModule
to imports ofTestBed.configureTestingModule
inabout.component.spec.ts