Hello how can I disable a select box, so that a user can only see the actual value of the select box and can't change the content inside. It's for an ionic framework mobile application.
My select box is looking like this one here:
<select ng-class="nightMode"
ng-options="option as option.label for option in item.Options track by option.id"
ng-change="item.Call(item.SettingKey,item.Checked.id)"
ng-model="item.Checked">
</select>
I tried with ng-disabled, disable inside the ng-options, ng-readonly but none of these worked for me. So what is the correct way to achieve this?
ng-disable example:
<select ng-class="nightMode"
ng-options="option as option.label for option in item.Options track by option.id"
ng-disabled="true"
ng-change="item.Call(item.SettingKey,item.Checked.id)"
ng-model="item.Checked">
</select>
Update: I tried one of the workarounds like suggested:
<select ng-class="nightMode"
ng-change="item.Call(item.SettingKey,item.Checked.id)"
ng-model="item.Checked">
<option ng-repeat="option in item.Options" value="option.id" ng-disabled="true" ng-selected="item.Checked.id==option.id">{{option.label}}</option>
</select>
But I can switch to a empty entry inside the select box and set the value of the selectbox to undefined.