相关疑难解决方法(0)

如何在项目中导入Angular Material?

我安装了Angular Material Design.现在我尝试在app.module.ts文件中添加:

import { MaterialModule } from '@angular/material';
Run Code Online (Sandbox Code Playgroud)

我应该在一节中解释:imports: []?加载所有材料实体.

我试过了:imports: ['MaterialModule']但它已被弃用了

angular-material angular

33
推荐指数
5
解决办法
7万
查看次数

模板解析错误:“ mat-sidenav-container”不是已知元素

我是Angular / material2的新手,我不确定尝试遵循上的文档时会丢失什么sidenav

在我的AppComponent中,我想显示一个sidenav,并实现如下:

app.component.tss

import {
    NgModule,
    Component
} from '@angular/core';
import {
    MatSidenavModule,
    MatSidenavContent,
    MatSidenav
} from '@angular/material';
import {
    BrowserAnimationsModule
} from '@angular/platform-browser/animations';

@NgModule({
    imports: [
        BrowserAnimationsModule,
        MatSidenav
    ],
    exports: [
        BrowserAnimationsModule,
        MatSidenav
    ]
})
@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})
export class AppComponent {
    title = 'app';
}
Run Code Online (Sandbox Code Playgroud)

app.component.html

<!--The content below is only a placeholder and can be replaced.-->
<mat-sidenav-container>

</mat-sidenav-container>
<div style="text-align:center">
    <h1>
        Welcome to {{ title }}!
    </h1>
    <nav> …
Run Code Online (Sandbox Code Playgroud)

angular

5
推荐指数
3
解决办法
1万
查看次数

标签 统计

angular ×2

angular-material ×1