Issue
With this following piece of code in html file which calls the ts file. Need help with calling the toggle function every time a user click on the left or right move button, so the selection can be false.
https://stackblitz.com/edit/angular-listbox?file=src%2Fapp%2Fapp.component.html
Solution
You can have a common function that does the unselection for you, once you move anything or everything.
public moveSelected(direction) {
// Your existing code here
this.unselectAll(); // Add this common function
}
public moveAll(direction) {
// Your existing code here
this.unselectAll(); // Add this common function
}
public unselectAll() { // Use this function as a helper to unselect everything
this.list1.map((i) => (i.selected = false));
this.list2.map((i) => (i.selected = false));
}
Answered By - Deepak
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.