Reputation: 20761
I've a small angular application(v9.1.12) that is working. I just added angular-material:
ng add @angular/material
Then I created an Angular Material module:
import { NgModule } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
@NgModule({
exports: [
MatButtonModule,
],
})
export class MaterialModule {}
then
I reference it in my app.module.ts:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { MaterialModule } from './material.module';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule,
MaterialModule,
BrowserAnimationsModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
As soon I add this reference, I get this error in chrome(but it still compiles):
platform.js:78 Uncaught TypeError: Class constructor Platform cannot be invoked without 'new'
at Module../node_modules/@angular/cdk/__ivy_ngcc__/fesm2015/platform.js (platform.js:78)
at __webpack_require__ (bootstrap:84)
at Module../node_modules/@angular/cdk/__ivy_ngcc__/fesm2015/a11y.js (a11y.js:1)
at __webpack_require__ (bootstrap:84)
at Module../node_modules/@angular/material/__ivy_ngcc__/fesm2015/core.js (core.js:1)
at __webpack_require__ (bootstrap:84)
at Module../node_modules/@angular/material/__ivy_ngcc__/fesm2015/button.js (button.js:1)
at __webpack_require__ (bootstrap:84)
at Module../src/app/material.module.ts (material.module.ts:1)
at __webpack_require__ (bootstrap:84)
What is the issue?
Upvotes: 0
Views: 449
Reputation: 1780
Issue in the angular/material version.please change the version of angular/material module.
you can use the below version.
npm i @angular/[email protected] --save
Upvotes: 1