Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 2: How do validate placeholder based on boolean condition

Tags:

angular

I have one textbox and initially it would be displaying some placeholder

<textarea class="some class" placeholder={{Some placeholder from REST API}}><textarea>

I want to disable this placeholder based on some boolean condition?

like image 393
Protagonist Avatar asked Nov 22 '25 09:11

Protagonist


1 Answers

<textarea [placeholder]="condition ? 'haha' : ''"></textarea>

If the placeholder from API is contained in variable, say: "apiPlaceHol" Then use it like this:

<textarea [placeholder]="condition ? apiPlaceHol : ''"></textarea>
like image 174
Ashish Ranjan Avatar answered Nov 24 '25 04:11

Ashish Ranjan