In AngularJs (1.x) there is facility to set true value and false value for input type checkbox using ngTrueValue ngFalseValue directives. But its been removed in Angular 2 +. Below is directive which will serve the same purpose as it was in AngularJs (1.x). Here it simply listens to the change event of input element using HostListener and value of input element is manipulated based on whether its checked or unchecked.

How to use:


Leave a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: