Try to search your question here, if you can't find : Ask Any Question Now ?

How to give dropdown values based on check and uncheck of checkbox in angular2

HomeCategory: stackoverflowHow to give dropdown values based on check and uncheck of checkbox in angular2
john asked 2 weeks ago

I have a checkbox based on selecting the checkbox, the values must be shown in the dropdown. But here, when i “unselect” both the checkboxes and again select both and “unselect” one, then the dropdown values remains same, it doesn’t reset. Can anyone help me to sort out this?

DEMO

Ts:

 setFaxId(index: number, faxQue: any) {
        faxQue.isChecked = (faxQue.isChecked) ? false : true;
        let filteredArr = this.faxqueuelists.filter(x=>x.faxQueueID == faxQue.faxQueueID);
        if (faxQue.isChecked) {
            this._selectedFaxQueList.push(faxQue.faxQueueID);
            this.dropDownFaxQueueList.push(filteredArr[0]);
            if(this.dropDownFaxQueueList.length == 1){
                this.userGroup.get("DefaultFaxQueue").patchValue(faxQue.faxQueueID);
            }

        } else {
            this._selectedFaxQueList.splice(this._selectedFaxQueList.indexOf(faxQue.faxQueueID), 1);
            this.dropDownFaxQueueList.splice(this._selectedFaxQueList.indexOf(faxQue.faxQueueID),1);
            this.userGroup.get("DefaultFaxQueue").patchValue("");
        }
    }
1 Answers
Best Answer
Matthias answered 2 weeks ago
Your Answer

15 + 15 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com