Reputation:
I am trying to add a condition to an input where is a variable = view then I add the readonly attr to the input.
This is what I'm trying:
<input *ngIf="mode == 'view' readonly">
This is not working at the moment.
What I'm I doing wrong here?
Upvotes: 1
Views: 7270
Reputation: 1149
Try
<input [readonly]="mode == 'view'">
It will add attribute readonly only when mode is equal to view
Upvotes: 10