css - How to fix the error “Could not find Angular Material core theme” in Angular 2? -


i practically new in angular2 , inherited project angular 2 frontend. after switching new angular 4.0 on console see error:

"compatibility.ts:221 not find angular material core theme. material components may not work expected. more info refer theming guide: https://material.angular.io/guide/theming"

the mdb.min.css in app/assets/css folder. specification in package.json shows following:

"@angular/common": "^4.0.0", "@angular/compiler": "^4.0.0", "@angular/core": "^4.0.0", ... "angular-bootstrap-md": "*" 

how fix error?

you have import theme global css or sass file:

@import "~@angular/material/prebuilt-themes/indigo-pink.css"; 

or alternatively include in index.html file:

<link href="node_modules/@angular/material/prebuilt-themes/indigo-pink.css" rel="stylesheet"> 

as in theming documentation mentioned angular material provides following pre-built themes:

  • deeppurple-amber.css
  • indigo-pink.css
  • pink-bluegrey.css
  • purple-green.css

you have include 1 of these themes or create own custom theme.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -