Is the function getting triggered once for each option in your checkboxlist.options
?
When you update a single selection in your checkboxlist.options
list, and it is re-rendering the whole DOM for each <li *ngFor
, you can help it be a little smarter.
For small applications where your looping over a handful of options this is not a big deal. However, it is good practice and if your list is large then you want to use trackBy
in your ngFor
If you use trackBy
then your list will ONLY update the list items that are changed.
There's a lot of references out there that will help you build your trackBy method better than I will, here is a good starting point for another StackOverflow question about it.
Good luck!