As follows:<input type="text" readonly="ifReadOnly()"/>
readonly="expression"
How to obtain it from the controller in expression?
if($scope.index == “0”){
$scope.ifReadOnly=function(){
return false;
}
}else{
$scope.ifReadOnly=function(){
return true;
}
}
readonly="expression" cannot be written as readonly="ifReadOnly()".
How to modify it so that readonly can work according to different values of expression?
Let’s do this:
html:
js:
用ng-readyonly, https://docs.angularjs.org/api/ng/directive/ngReadonly