【发布时间】:2020-03-29 19:51:54
【问题描述】:
我在 AngularJS 的 JavaScript 中有以下内容
$("#listOptionFruit").kendoDropDownList({
autoBind: true,
filter: 'contains',
dataSource: $scope.listOptionFruitList,
select: $scope.listOptionFruitSelect
});
$scope.listOptionFruitSelect = function (e)
{
$scope.listOptionFruit = e.dataItem;
if ($scope.listOptionFruit === 'Strawberry') {
$scope.enableMe = true;
}
else
{
$scope.enableMe = false;
}
}
而cshtml端如下:
<label for="listOptionFruit">Fruits</label>
<input id="listOptionFruit" name="listOptionFruit" required />
<label for="myValue">MyValue</label>
<input type="text" id="myValue" ng-disabled="enableMe" />
所以 enableMe 的值是正确的,但是文本框似乎没有被禁用或操作似乎没有生效。
所以如果用户从列表中选择草莓,那么文本框被禁用,否则它被启用
【问题讨论】:
标签: javascript angularjs kendo-ui