我正在使用最新版本的角和角材料。我按照主题指南
https://material.angular.io/guide/theming
. 我正在应用程序中使用一个预构建主题,但无法将应用程序更改为暗模式。
我的代码如下。
app.component.html软件
ng-container [class.dark-theme]="isDark" class="mat-app-background">
<mat-sidenav-container>
<mat-sidenav></mat-sidenav>
<mat-sidenav-content>
<app-request></app-request>
<app-benchmark></app-benchmark>
</mat-sidenav-content>
</mat-sidenav-container>
</ng-container>
应用组件
export class AppComponent implements OnInit {
isDark = true;
ngOnInit(): void {
}
}
样式表
/* You can add global styles to this file, and also import other style files */
@import '~@angular/material/prebuilt-themes/indigo-pink.css';
html, body { height: 100%; }
body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }
我可以看到我的应用程序的材料,它只是不应用黑暗模式。我遗漏了什么吗?