0

I have used angular2 dropdown multi-select using below code

 <ss-multiselect-dropdown [options]="myOptions" name="pack" [texts]="myTexts" [settings]="mySettings" [(ngModel)]="model.selectedPackValue"  [disabled]="canViewData">

But I can not able to disable this dropdown when my 'canViewData' is true

Then how to disable it ?

2
  • It should work fine. Check your canViewData once. Commented Dec 29, 2016 at 13:01
  • 2
    best way to set true value static and if it work replace with variable Commented Dec 29, 2016 at 13:02

2 Answers 2

3

I found my solution as including below code in my multiselectdropdown.ts

At 117 line add @Input() disable: string;

and also add attribute to button at 76 line [disabled]="disable"

Now the below code in my template works fine..

<ss-multiselect-dropdown [options]="myOptions" name="pack" [texts]="myTexts" [settings]="mySettings" [(ngModel)]="model.selectedPackValue"  [disable]="canViewData">

(and also above all changes are applied to multiselectdropdown.js)

Sign up to request clarification or add additional context in comments.

Comments

1

Your are using some plugin

I think this is the one https://github.com/softsimon/angular-2-dropdown-multiselect

Go to your node_modules folder from your solution and find the file 'multiselect-dropdown.ts'

https://github.com/softsimon/angular-2-dropdown-multiselect/blob/master/src/multiselect-dropdown.ts

At 117 line add

@Input() disable: boolean;

At 76 add attribute to button

[disabled]="disable"

Now try the below code in your template this may help

<ss-multiselect-dropdown [options]="myOptions" name="pack" [texts]="myTexts" [settings]="mySettings" [(ngModel)]="model.selectedPackValue"  [disable]="canViewData">

3 Comments

And what do you do if they update the multiselect ? You do that again ?
If i need urgent solution,I do like this, . May be i am wrong. But reporting to github and waiting for update may takes time? If you have any proper way ,kindly comment.
Here in @Input() disable: boolean; have not worked for me because it gave me error as BOOLEAN is not defined so instead of BOOLEAN i have used STRING then everything works fine. Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.