1

I am using *ngIf to conditionally show a block of code which works as I need it.

However I need to use [hidden] or display:none to actually hide the block in the dom. As I understand I can only provide true or false with [hidden].

How can I conditionally hide this from the Dom using [hidden] or [class] ?

<div *ngIf="raid != -1;">
    <p>Need to display:none inside of this</p>
</div>
ottz0
  • 2,595
  • 7
  • 25
  • 45

1 Answers1

0

You have to add your hidden option within the tag:

<p [hidden]="true">Need to display:none inside of this</p>

And replace the true within the "" with your variable name

Or as such if you want to hide just a part of the text:

<p>some text <span [hidden]="true">this will be hidden (or not) </span>some more text</p>
Romanow
  • 124
  • 2
  • 6