Paco Zevallos
Paco Zevallos

Reputation: 2275

* ngIf show div conditional value (less than)

I have an input with a numerical value, then that value is multiplied by 2 and the result is displayed. For example 1000 x 2 = 2000. How do I show a div as long as the result is less than 122?

<input type="number" [(ngModel)]="valueInitial">
<div>Result: {{ valueInitial * 2 }}</div>

Upvotes: 1

Views: 2956

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222582

As you say in the question you should use *ngIf

<div *ngIf="valueInitial * 2 < 122">Result: {{ valueInitial * 2 }}</div>

DEMO

Upvotes: 1

Related Questions