I have field which get the input of the user and according to it the below element will show what has been written
<label>message</label>
<input type="text" name="name" [(ngModel)]="person.message"class="form-control">
<label class="label">you've written this </label>
<input type="text" name="name" disabled value="{{message}}" class="form-control">
this code works fine but I want to assign a condition to the shown value which is somthing like this:
*ngIf=person.message!=null?{{message}}":'write'
which means if the input filed is not null show what is written else show the word write
You can use ternary operator within {{...}}
<input type="text" name="name" disabled value="{{person.message!=null ? message : 'write'}}" class="form-control">
Or set value as a property with ternary operator.
<input type="text" name="name" disabled [value]="person.message!=null ? message : 'write'" class="form-control">