unable to use other variables and functions in verify method
Opened this issue · 2 comments
kajalbh99 commented
verifyTag(str: string): boolean{ **this.taggedUser(str);** return str !== 'ABC' && str.trim() !== ''; }
thelebdev commented
Can you please further explain your issue?
chetanbansal019 commented
I am facing the same issue.. the exact issue is that inside the verifyTag method, we cannot access any other class property or method, which are defined outside its scope.
verifyTag(str: string): boolean{
var patt = /^[0-9]{10,12}$/;
var validity = patt.test(str);
if(validity){
this.testValildate.emailError = false }
else{
this.testValildate.emailError = true
}
return validity;
}
Here, this.testValildate is undefined.
Any solution?