Reputation: 1453
When user select master checkbox all values must be push to array. Value must splice from array when user unselect specific checkbox and push again to array if select again. Here is my sample code in stackblitz. Thank you in advance.
Upvotes: 0
Views: 1013
Reputation: 6193
There were a few mistakes in your code, notably that you didn't check for the correct property on the MatCheckboxChange
event. You checked for the check
property, when it is actually called checked
, see here.
Also you tried to use splice
with a string
(the name
property of the current row
) and number
argument, when in fact it takes number, number
.
A proper IDE would notify you of these mistakes and help you solve them.
Here is a working version of your table.
Upvotes: 2