How to implement Custom Async Validator in Angular2/4/5

You need to bind your method on the component instance itself as described below:

this.myForm = formBuilder.group({
            ImageId: ["",    
               Validators.required, 
               this.asynValidator.bind(this)]
    });

Otherwise you won’t be able to use the http property to execute your request.

This article could also give you some hints about asynchronous form validation (see the section “asynchronous validation”):

Leave a Comment