Hem*_*uri 5 angularjs angular-material angularjs-ng-disabled
我遇到了ng-disable的问题.因为我使用棱角分明的材料我觉得这不起作用.我希望根据条件动态禁用或启用输入框.
注意: - 我有多个输入字段我想要禁用或一次性启用所有输入.
我这样想
<md-input-container class="md-block" flex-gt-sm>
<label for="Autocomplete">From</label>
<input required type="text" class = "hideShadow" ng-model="FromLocation"
uib-typeahead="state for state in states | filter:$viewValue | limitTo:8"
class="form-control" ng-disabled="isDisabled">
<div ng-messages="searchFlight.FromLocation.$error">
<div ng-message="required">Please enter from location</div>
</div>
</md-input-container>
Run Code Online (Sandbox Code Playgroud)
我试图ng-disabled="isDisabled"像这样动态访问
$scope.isDisabled = true;
Run Code Online (Sandbox Code Playgroud)
但这不起作用.我可以知道我哪里错了吗?
小智 7
我相信问题在于你绑定属性isDisabled的方式.
试试这个:
$scope.model = {
isDisabled: true
};
Run Code Online (Sandbox Code Playgroud)
然后:
ng-disabled="model.isDisabled"
Run Code Online (Sandbox Code Playgroud)
当我们尝试绑定指令上的原始属性时会发生此问题.我们需要绑定对象的属性才能正常工作.
| 归档时间: |
|
| 查看次数: |
19885 次 |
| 最近记录: |