Hide/Show material components

11,601

Your syntax is correct, and it should work. Check again the value of displayNoSignUp in your component.

Share:
11,601

Related videos on Youtube

faizanjehangir
Author by

faizanjehangir

Updated on June 04, 2022

Comments

  • faizanjehangir
    faizanjehangir almost 2 years

    I have a simple mat-card that I want to show/hide based on a value. However, *ngIf directive does't seem to work on it.

    <mat-card *ngIf="displayNoSignUp">Simple card</mat-card>
    

    Is there a way to do it using a directive on the material components? Or should it be wrapped inside an html div?

    • Andres M
      Andres M about 6 years
      Many ways to do it. If you say *ngIf is not working, you could try [class.hidden]="displayNoSignup" and the set display:node in the hidden css class. This would hide it but the markup would still be there
  • faizanjehangir
    faizanjehangir about 6 years
    Excuse thy lack of attention. The boolean values were reversed.