I\'m building an Angular 2 application (2.0) and I\'ve got a form that makes use of the ReactiveForms
module. As such, I\'m using validator functions on the in
Your validator is not being called with your component as this
. Notice that you are passing a loose reference to this.userNameAsyncValidator
You can bind your validator without worrying about this
conflicts because angular validation doesn't rely on this
userName = new FormControl("", [
Validators.required
], [
this.userNameAsyncValidator.bind(this)
]);