嗨,我有一个问题,禁用选定的选项卡时,页面加载。我的js代码如下所示。
(function() {
  angular.module('chosenExampleApp', ['localytics.directives']).controller('IndexCtrl',function($scope) {
      $scope.testProp = "hello";
      $scope.myPets = ['cat'];
      $scope.pets = {
        cat: 'Cat',
        dog: 'Dog',
        hamster: 'Hamster'
      };  
    })
}).call(this);Html正文如下所示。
<body ng-controller="IndexCtrl">
    Disable <input type="radio" ng-model="testProp" name="radiotest" value="hello"/>
    Enable <input type="radio" ng-model="testProp" name="radiotest" value="hello1"/>
  <select
    multiple
    ng-model="myPets"
    ng-options="value as label for (value, label) in pets"
    chosen
    ng-disabled="testProp=='hello'"
    style="width:200px;">
  </select>
</body>由于testProp的值设置为hello,所以我希望在页面加载时禁用所选的值。但是当页面启用时,我选择了loads.Once按钮,然后选择禁用,它可以正常工作。请告诉我如何解决这个问题。
柱塞的链接是这里
发布于 2015-08-12 21:56:32
那么,看起来就像指令中的一个bug,即:它在初始化所选插件之前移除disabled属性。这个线路
stopLoading = -> element.removeClass('loading').attr('disabled', false).trigger('chosen:updated')是问题所在。它应该是:
stopLoading = -> element.removeClass('loading').attr('disabled', attr.disabled).trigger('chosen:updated')您可以修补源代码或等待/修复它,我打开了问题这里。
下面是固定的演示:http://plnkr.co/edit/gFLbMpG93TtB9xQBNTfH?p=preview
https://stackoverflow.com/questions/31957415
复制相似问题