This may be an easy question/answer, but I can't seem to wrap my head around it: I am validating fields with a function using AbstractControl:
errorVar: boolean = false
function(c: AbstractControl): {[key: string]: string } | null {
// validation if 'test' is true or not goes here
if(test) {
let errorMessageText: "test"
return {'errorText': errorMessageText};
}
return null;
}
Besides the errorText I want the function to also set the variable errorVar to true and to false if the function returns null.