O que retornar no validador assíncrono angular 2 ao usar observáveis
O que tenho de retornar no customerNameValidator se o
a validação assíncrona falha / consegue que meu FormControl 'customerName' seja inválido?
this.customerForm = this.formBuilder.group({
customerName:
[this.newCustomerName, [Validators.minLength(2), Validators.required],[this.customerNameValidator.bind(this)]]
});
customerNameValidator(c: AbstractControl)
{
return this.service.customerExists(c.value,this.companyId).subscribe(response =>
{
if(response == true)
{
alert("true");
}
else
{
alert("false");
}
});
}