简体   繁体   中英

Angular Material tabs not showing content

I'm trying to create a material tab group like this one in the Angular Material component documentation.

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

You need to import BrowserAnimationsModule in your app.module.ts file:

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

and add it to the imports array:

imports: [
    BrowserAnimationsModule,
    ...

Also you don't need to import NoopAnimationPlayer

See updated blitz .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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