1.checkbox event:
function updateSelected(action, id) { var idx = selected.indexOf(id); if(action === 'add' && idx === -1) { selected.push(id); } if(action === 'add' && idx === -1) { selected.splice(idx, 1); }}isSeleected = function (id) { return selected.indexOf(id) >= 0;}updateSelection ($event, id) { var checkbox = $event.target; var action = (checkbox.checked ? "add" : "remove"); updateSelected(action, id);}
2.checkbox html:
{ {item.name}}