Is there a way to select multiple checkbox based on shift and click in Angular 2. Is there any module in angular 2? Want angular 2 solution, not jquery or JavaScript solution.
Asked
Active
Viewed 2,233 times
0
-
You mean all boxes by shift click? – alexKhymenko Sep 18 '17 at 17:55
-
Possible duplicate of [How can I shift-select multiple checkboxes like GMail?](https://stackoverflow.com/questions/659508/how-can-i-shift-select-multiple-checkboxes-like-gmail) – Neeraj Kumar Sep 18 '17 at 18:18
-
After selecting first checkbox if user clicks on another checkbox along with shift key, it should select all the checkbox in-between – Amit Kumar Tiwari Sep 18 '17 at 18:22
-
And the ask is for angular 2 solution, not jquery solution. – Amit Kumar Tiwari Sep 18 '17 at 18:25
1 Answers
0
Checkout this plunkr I altered with one way of getting the behavior you're looking for.
https://embed.plnkr.co/A8czIBHgVorKHqGRqNmk/
Basically, listen for click events, check if the shift key is held, do your checkbox logic, and then set the shiftHeld variable back to false (when a key goes up)
All of the logic is in the dashboard component and template

Pezetter
- 2,783
- 2
- 22
- 40