angular2-form-validation-example
angular2-form-validation-example copied to clipboard
I had to change fail on resolve as well to get Promise to work
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;
}
by the way if you want to see a massive ng2 app check out: http://ng2.javascriptninja.io