简体   繁体   English

角材料选项卡不显示内容

[英]Angular Material tabs not showing content

I'm trying to create a material tab group like this one in the Angular Material component documentation. 我试图在Angular Material组件文档中创建一个像这样的材质选项卡组。

The problem I'm encountering is that the content of the tabs isn't loading/showing. 我遇到的问题是选项卡的内容未加载/显示。 I've copied the exact code from the docs, but still no luck. 我已经从文档中复制了准确​​的代码,但是仍然没有运气。

The code I used: 我使用的代码:

<mat-tab-group>

  <mat-tab label="One">
    <h1>Some tab content</h1>
    <p>...</p>
  </mat-tab>

  <mat-tab label="Two">
    <h1>Some more tab content</h1>
    <p>...</p>
  </mat-tab>

</mat-tab-group>

I've recreated the issue on StackBlitz 我已经在StackBlitz上重新创建了该问题

You need to import BrowserAnimationsModule in your app.module.ts file: 您需要在app.module.ts文件中导入BrowserAnimationsModule

import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

and add it to the imports array: 并将其添加到导入数组:

imports: [
    BrowserAnimationsModule,
    ...

Also you don't need to import NoopAnimationPlayer 另外,您也不需要导入NoopAnimationPlayer

See updated blitz . 参见更新的闪电战

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM