Using Angular 5.1.1, I am attempting to call a function when a checkbox changes. This method works fine for text types but for checkbox input types it always sends the value of "on" to the function even when the box is unchecked. Can anyone explain what I am doing wrong?
<input type="checkbox" name="enabled" [checked]="score?.enabled" #enabled (change)="OnFieldChanged(enabled.value)" />
Here is the component
import { Component} from '@angular/core';
@Component({
selector: 'score',
templateUrl: './score.component.html',
styleUrls: ['./score.component.less']
})
export class ScoreComponent {
public score: IScore;
constructor() {
}
OnFieldChanged(value: string): void {
var fieldValue = value;
}
}