<input type="checkbox" [name]="filter.filterName" ngModel />
let filterValue: string = testForm.form.value[filter.filterName];
filterValue is always returning empty string checkbox when checked and unchecked
how can i know that checkbox is checked or not in template driven form and no data binding. I need value from testForm:NgForm object ?
how can i know that checkbox is checked or not in template driven form and no data binding.
You can use template variable.
html:
<input type="checkbox" #check />
ts:
@ViewChild('check')
check: ElementRef;
stackblitz : https://stackblitz.com/edit/angular-udaej4