Using Data-binding with Angular 2 to disable a button
I received a question from a customer new to AngularJS asking for the right way to disable a button until at least one checkbox was checked. The customer’s first thought was to recognize an event on the checkbox and react to it, but this is not necessary with the data-binding feature of Angular.
You can use 2-way data-binding on the checkbox to a Boolean property on the component. So, as soon as the user modifies the checkbox, the change is reflected in the component. Also, use 1-way data-binding on the disabled property of the button to a method on the component that returns the condition you want to test. In this case the method returns true if any items have been selected.
Component Template
Component Class
Note: This code has been tested with RC6 of Angular 2.