I'm trying to integrate Angular's material design and I'm the following the official documentation .
I have installed the compnents and hammerJS using npm:
npm install --save @angular/material
npm install --save hammerjs
And in my app.module.ts
I have called the MaterialModule
and hammerjs
:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { MaterialModule } from '@angular/material';
import { AppComponent } from './app.component';
import { HeaderComponent } from './comps/header.component';
import 'hammerjs';
@NgModule({
imports: [ BrowserModule, MaterialModule ],
declarations: [ AppComponent, HeaderComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
But the console gives me this error:
GET http://localhost:3000/hammerjs 404 (Not Found)
What am I missing here ?
If it's simply a JS library, you can add it as a script in your index.html file.
You would typically import it if there is a typings for it, but I wouldn't import just a JavaScript file.
Look in your node_modules folder and add something like:
<script src="node_modules/hammerjs/... .js"></script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.