我正在构建一个Angular 4应用程序,它需要在几个组件的表单字段上进行BriteVerify电子邮件验证.我正在尝试将此验证实现为自定义异步验证器,我可以将其与反应式表单一起使用.目前,我可以获得API响应,但控制状态仍处于暂挂状态.我没有错误,所以我有点困惑.请告诉我我做错了什么.这是我的代码.
import { Component,
OnInit } from '@angular/core';
import { FormBuilder,
FormGroup,
FormControl,
Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { EmailValidationService } from '../services/email-validation.service';
import { CustomValidators } from '../utilities/custom-validators/custom-validators';
@Component({
templateUrl: './email-form.component.html',
styleUrls: ['./email-form.component.sass']
})
export class EmailFormComponent implements OnInit {
public emailForm: FormGroup;
public formSubmitted: Boolean;
public emailSent: Boolean;
constructor(
private router: Router,
private builder: FormBuilder,
private service: EmailValidationService
) { }
ngOnInit() {
this.formSubmitted = false;
this.emailForm = this.builder.group({
email: …Run Code Online (Sandbox Code Playgroud)javascript angular-validation angular angular-reactive-forms