I want to disable the angular select dropdown. Actually I want restrict the access for few users. Code link:http://plnkr.co/edit/mGnpQynWKkRLBC0VEHBR?p=preview
1 Answer
In controller add:
$scope.isDisabled = false; // change to true to disable the multiselect
Then, the view should be (look at the disabled attribute):
<multiselect class="input-xlarge" multiple="true"
ng-model="selectedCar"
options="c.name for c in cars"
change="selected()" disabled="isDisabled"></multiselect>
Finally, add the proper logic to set the $scope.isDisabled in your controller.
8 Comments
Pawan
HI Thanks for your suggestion, But i tried the same above solution but wont work it for me may be i put the controller not proper place. can you tell where i have to add controller in the bellow code >>>>>>>>>>>>>>> var app = angular.module('plunker', ['ui.multiselect']); app.controller('MainCtrl', function($scope) { $scope.name = 'World'; $scope.cars = [{id:1, name: 'Audi'}, {id:2, name: 'BMW'}, {id:1, name: 'Honda'}]; $scope.selectedCar = []; $scope.fruits = [{id: 1, name: 'Apple'}, {id: 2, name: 'Orange'},{id: 3, name: 'Banana'}]; $scope.selectedFruit = null; });
alle
Please, reread my answer. I just forked your plnkr that include my modifications: plnkr.co/edit/oWPIPH5XVPI7UNZsB2Gz?p=preview
Pawan
but as you can also see the output in plunkr it's not working. It should be disabled right
alle
change $scope.isDisabled to true in your controller and it will be disabled
Pawan
Hi i have one more question. Actually this mainly i have to used for this logic when the admin is opened all fields will be accessible. when other users access i want disable for specific users can you give any solution for this
|