-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Angular 2 Cookbook
By :

A standard validator operates under the assumption that the validity of a certain input can be calculated in a short amount of time that the application can wait to get over with before it continues further. What's more, Angular will run this validation every time the validator is invoked, which might be quite often if form validation is bound to rapid-fire events such as keypresses.
Therefore, it makes good sense that a construct exists that will allow you to smoothly handle the validation procedures that take an arbitrary amount of time to execute or procedures that might not return at all. For this, Angular offers async Validator
, which is fully compatible with Promises
.
The code, links, and a live example related to this recipe are available at http://ngcookbook.herokuapp.com/7811/.
Suppose you had started with the following skeleton application:
[app/article-editor.component.ts] import {Component...