I have tried this
export function uniqueUserNameValidation(commonsService: CommonsService): AsyncValidatorFn {
return (c: AbstractControl): Promise < ValidationErrors | null > | Observable < ValidationErrors | null > => {
return commonsService.uniqueUserName(c.value).pipe(
map(data => {
return data && data.status ? {
'uniqueValidation': true
} : null
})
)
}
}
Common Services Method
uniqueUserName(name:string){
return this.http.get<booleanData>(constDefault.API_URL+"/commons/nameAlreadyExist/"+name+"/Tank")
}
I am getting this error
core.js:1673 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'uniqueUserName' of undefined TypeError: Cannot read property 'uniqueUserName' of undefined