Answers for "custom validator ERROR TypeError: "this.myForm.controls.cnfPass is undefined""

0

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};
    }
  }
Posted by: Guest on May-16-2020

Code answers related to "custom validator ERROR TypeError: "this.myForm.controls.cnfPass is undefined""

Code answers related to "TypeScript"

Browse Popular Code Answers by Language