How to fix Error `$map` of `map-get($map, $key)` must be a map in angular / stackblitz

夙愿已清 提交于 2019-12-11 10:53:33

问题


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.

来源:https://stackoverflow.com/questions/57181182/how-to-fix-error-map-of-map-getmap-key-must-be-a-map-in-angular-stac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!