ng validation for ionic checkbox
export class RegisterComponent {
registerForm: FormGroup;
email = new FormControl('', [Validators.required]);
password = new FormControl('', [Validators.required]);
termsAndConditions = new FormControl(undefined, [Validators.required]);
constructor(private formBuilder: FormBuilder) {
this.registerForm = this.formBuilder.group({
'email': this.email,
'password': this.password,
'termsAndConditions': this.termsAndConditions
}, {validator: this.checkCheckbox });
}
public checkCheckbox(c: AbstractControl){
if(c.get('termsAndConditions').value == false){
return false;
}else return true;
}
}