Reputation: 7640
I would like to disable the input under certain conditions. Show the value, but not beeing able to modify it.
I tried to add an ng disable, or ng class, but it doesn't look to work for me.
<div ng-controller="SettingsController">
<md-input-container ng-class="{'md-block' : model.isDisable" ng-disabled="model.isDisabled">
<input ng-model="obj.name" aria-label="name" />
</md-input-container>
</div>
http://plnkr.co/edit/cReJQlhNOBzB7VihhRS5?p=preview
Upvotes: 0
Views: 1064
Reputation: 6728
Move your ng-disabled to the input tag. It should work.
<div ng-controller="SettingsController">
<md-input-container ng-class="{'md-block' : model.isDisable" >
<input ng-model="obj.name" aria-label="name" ng-disabled="model.isDisabled" />
</md-input-container>
</div>
Also there is an out-of-place '{' in the ng-class that bothers me but the code still works so I didn't change it since I don't know if it is necessary.
Upvotes: 1