I have scope in controller: $scope.readOnly = true
then I have code in html:
<select ng-if="readOnly" ng-model="readOnly" required>
<option value="true" selected>True</option>
<option value="false">False</option>
</select>
<select ng-if="!readOnly" ng-model="readOnly" required>
<option value="true">True</option>
<option value="false" selected>False</option>
</select>
<button ng-click="save()"> Save</button>
but it doesn't work fine :/ on click save, the result is undefined :/ how to make this correct?
$scope.doc.readOnlydosen't work, because you must to initialize$scope.docas an object. Correct initialize:$scope.doc = { readOnly: true };