angular2-form-validation-example icon indicating copy to clipboard operation
angular2-form-validation-example copied to clipboard

I had to change fail on resolve as well to get Promise to work

Open born2net opened this issue 9 years ago • 1 comments

export default function NameTakenValidator(control:Control):Promise<ValidationResult> {
    let q = new Promise((resolve, reject) => {
        setTimeout(() => {
            if (control.value === 'Sean') {
                resolve({"taken": true});
            } else {
                resolve(null);
            }
        }, 1000)
    });
    return q;
}

born2net avatar Jan 06 '16 06:01 born2net

by the way if you want to see a massive ng2 app check out: http://ng2.javascriptninja.io

born2net avatar Jan 06 '16 06:01 born2net