custom validator ERROR TypeError: "this.myForm.controls.cnfPass is undefined"
let _this = this
this.myForm = this.fb.group({
'sku': ['', Validators.compose([Validators.required,this.skuValidator])],
'question' : ['', Validators.required]
});
skuValidator(control: FormControl): { [s: string]: boolean } {
if (!control.value.match(/^123/)) {
alert('Inside skuValidator');
console.log('value of this :: ' , _this);
return {invalidSku: true};
}
}