I have issue with ng-disabled AngularJs directive its working good in chrome but its not working in IE 9 , Any solution to make it work will be appreciated.
main.html
<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="{{disableAssessmentType? 'disabled': ''}}"
ng-model="riskAssessmentDTO.riskAssesLevelLookupCode"
></select>
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
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With