Monday, December 24, 2018

Set the state of a checkbox with boilerplate code in an Angular 6 application.

Assuming something like this...

@ViewChild('checky') checky: ElementRef<HTMLInputElement>;

 
 

You could have something like this:

if (this.modalMetadata.president.HasNonconsecutiveTerms) {
   this.checky.nativeElement.checked = true;
} else {
   this.checky.nativeElement.checked = false;
}

No comments:

Post a Comment