How to use Badge from angular material?

965    Asked by VictoriaMartin in Python , Asked on Feb 3, 2020
Answered by Victoria Martin

We need to import MatBadgeModule in order to use it.

import {

  ...

  MatBadgeModule,

  ...

} from '@angular/material';

@NgModule({

  exports: [

    ...

    MatBadgeModule,

    ...

  ]

})

export class MaterialModule { }

Also, we need to import the theme style of angular/material in styles.css.

@import '~@angular/material/prebuilt-themes/deeppurple-amber.css';


After that we can use it like this:

Text with a badge



Your Answer

Interviews

Parent Categories