0

Here I want to remove selected item from array when I changed dropdown. I have few item in checkbox list and onselect I am pushing item in array but when I change dropdown then selected item should be removed from array. I have reproduced my issue on here,Please have a look on this link https://stackblitz.com/edit/angular-rhkz6i?file=src%2Fapp%2Fapp.component.ts

2
  • so after resetting the selectedGroups on changing the option, do you want to get get the selected checkboxes back once you re-select the same option. ? Commented May 4, 2019 at 7:55
  • Yes, if it is possible please Commented May 4, 2019 at 8:07

2 Answers 2

4

You can just add this.selectedGroups = []; in your setGroup function so it can be reset

setGroup(nav:any, index){this.selectedGroups = [];}
Sign up to request clarification or add additional context in comments.

Comments

1

I think you just want to reset this.selectedGroups. So inside setGroup(nav:any, index), add a line with this.selectedGroups = []

Comments

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.