0

I'm using Angular 11. Somehow I can't make this div disappear: My simple HTML :

<div ng-hide="true">Test</div>

Result -> The Text Test still appears on my page.

Alireza Ahmadi
  • 8,579
  • 5
  • 15
  • 42
Boommeister
  • 1,591
  • 2
  • 15
  • 54

2 Answers2

0

ng-hide and ng-showdon't exist in Angular 2+ only in AngularJS. I'm using

<div [hidden]="true">Text</div>

now.

https://www.telerik.com/blogs/what-is-the-equivalent-of-ng-show-and-ng-hide-in-angular

Boommeister
  • 1,591
  • 2
  • 15
  • 54
0

In Angular2+ there is no directive with ng- format. This format is available only for angular.js. But you know there is almost equivalent directive in Angular2+.

For your question there are some ways to do the same behavior of ng-hide:

First one is: [hidden]=true:

<div [hidden]="true">…content..</div>

Second one is: *ngIf

<div *ngIf=”bolShow”>…content…</div>

Third one is style binding like this: [style.visibility]

<div [style.visibility]="bolShow ? 'visible' : 'hidden'">…content…</div>
Alireza Ahmadi
  • 8,579
  • 5
  • 15
  • 42