How to fix Error `$map` of `map-get($map, $key)` m

2019-08-10 00:14发布

Attempting to create a custom theme with a theme.scss in Stackblitz created the error "Error in @angular/material/_theming.scss (1262:14) argument $map of map-get($map, $key) must be a map".

I commented out every section that I thought might be responsible, which did not help. It looks like the error is actually in the angular material, but changing the material-version in package.json did not help either. I found a similar bug Error when creating Angular 2 custom theme, but the question was never answered because they did not provide code. So here's mine:

@import '~@angular/material/theming';

@include mat-core();

$my-theme-primary: mat-palette($mat-light-green);
$my-theme-accent: mat-palette($mat-lime);
// $my-theme-background: mat-palette(#F1F8E9);
$my-theme-warn:    mat-palette($mat-red);

$my-theme-theme: mat-light-theme($my-theme-primary, $my-theme-accent, $my-theme-warn
// , $my-theme-background
);

@include angular-material-theme($my-theme-theme);

See my Stackblitz for the entire environment.

Any hint as to what I did wrong is appreciated.

0条回答
登录 后发表回答