savantKing
savantKing

Reputation: 89

How to hide text when array.length === 0

So I want to hide the some text, when the array.length is 0.

So this is the template:

 <h3>{{ OkrSensoren }}</h3>
       

So I want to hide the text: <h3>{{ radarSensoren }}</h3>

when radarSensors.length === 0

and this is ts script:

radarSensoren = 'Radar sensoren';

But it doesnt hide the text. And the array is emtpy:

radarSensors: Array(0)
length: 0

Upvotes: 0

Views: 459

Answers (1)

Arcord
Arcord

Reputation: 1909

You already apply the same kind of logic below, why do you not apply it at your "h3" tag ?

<h3 *ngIf="radarSensoren.length !== 0">{{ radarSensoren }}</h3>

Or

<h3 *ngIf="!!radarSensoren">{{ radarSensoren }}</h3>

Upvotes: 2

Related Questions