AngularJs ng-disabled is not working in IE 9 any solution?

那年仲夏 提交于 2019-12-05 10:58:23

I'm currently having the same issue with ng-disabled. Unfortunately, the only workaround that I could think of was to handle the logic of the ng-disabled in the controller. So in your case:

<select kendo-drop-down-list k-data-text-field="'text'"
    k-option-label="'Select'" k-data-value-field="'id'"
    k-data-source="assessmentOptions" name="riskAssesLevelLookupCode"
    Required id="riskAssesLevelLookupCode"
    maxlength="256"
    ng-attr-disabled="checkForDisabled()"
    ng-model="riskAssessmentDTO.riskAssesLevelLookupCode">
</select>

And in the controller:

checkForDisabled() {
    if(disableAssessmentType) {
       return "disabled";
    } else {
       return "";
    }
}

Then again, this won't garanty the right behavior on IE9. In my case I was trying to avoid the functionality of an ng-click event. So I set a flag to false when the disabled was set and according to that flag I called the function. Something like this:

<button ng-click="callMethod()" ng-disabled="checkDisabled()">
  Click me if Im enabled
</button>

Controller:

checkDisabled() {
   // Let's say it's disabled
   $scope.isDisabled = false; // set a global flag
   return false;
}

callMethod() {
   if($scope.isDisabled) {
        //disabled, do nothing maybe handle an error?
   } else {
        //functionality when it's enabled
   }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!