shv22
shv22

Reputation: 690

Not able to disable a multi-select drop down

Hi I am new to AngularJs. Here my problem is on a certain condition I need to disable my multiselect dropdown.

So, I made the logic and on with the help of I tried to disable the dropdown-

document.getElementById("multidropdown").disabled = true;

But no luck.

So, then I google it and get to know about ng-disable. So, I put a ng-disable there and give it a name like this

ng-disabled="makeItDisabled"

And in my js file, I set

$scope.makeItDisabled = false

And in the condition, I made the same

$scope.makeItDisabled = true

But still got no luck.

This is my HTML-

column type="dropdownMultiSelect" styleName="form-control ng-isolate-scope multidropdown" ng-dropdown-multiselect=""  options="dropdownData" selectedmodel="dropdownelect" extrasettings="multiselectsettings"  events="DropDown_changed" text=""  uniqueID="multidropdown" ng-disabled=" makeItDisabled

This is my js code which I have tried

document.getElementById("multidropdown").disabled = true;

and also

$scope.makeItDisabled = true;

I did the same with the disabled also but there also I was not able to do it. I want to know where I am getting it wrong.

I am using this https://github.com/dotansimha/angularjs-dropdown-multiselect

Upvotes: 1

Views: 9269

Answers (3)

Try this:

  <ng-multiselect-dropdown 
       [placeholder]="' '" [data]="myList"
       [(ngModel)]="mySelectedItems" [settings]="mySettings"
       (onSelect)="onItemSelect($event)" (onDeSelect)="onItemDeSelect($event)"
       (onSelectAll)="onSelectAll($event)" 
       (onDeSelectAll)="onDeSelectAll($event)"
       [disabled]=!isToDisable()>
  </ng-multiselect-dropdown>

Upvotes: 2

shv22
shv22

Reputation: 690

Finally I was able to do it by just using css

I disabled the dropdown by using

pointer-events:none;

Upvotes: 5

shiva prasad patil
shiva prasad patil

Reputation: 61

Use ng-disabled not ngdisabled and it should work. Post further if you have any queries

Upvotes: 0

Related Questions