I want to disable a specific option from the AngularJS drop-down list.
It should be listed in the drop-down list, but should not allow it to choose. So I need to disable it.
MyFile.tpl.html
<select class="form-control" ng-model="selectedFruits"
ng-options="fruit as fruit.name for fruit in fruits">
</select>
Mycontroller.js
$scope.fruits = [{'name': 'apple', 'price': 100},{'name': 'guava', 'price': 30},
{'name': 'orange', 'price': 60},{'name': 'mango', 'price': 50},
{'name': 'banana', 'price': 45},{'name': 'cherry', 'price': 120}];
Here, all fruit names should be listed in the drop-down list, but mango and cherry should be disabled and should not allow the user to select it.
Is it possible? If possible, please let me know the solution, please.
source
share