I have multiple checkboxes and a button that has to be enabled only if at least one checkbox is selected
VALUE1
One way is to use ngModel on each checkbox, then control the button's disabled property via a method that examines each checkbox model state:
@Component({
template: `
`
})
class App {
checkboxes = [{label: 'one'},{label: 'two'}];
constructor() {}
buttonState() {
return !this.checkboxes.some(_ => _.state);
}
}
Plunker