Reactive Forms


Match two control values, for examples:

this.form = new FormGroup({
  pwd: new FormControl(''),
  repwd: new FormControl(''),
}, {
  validators: MatchControl('pwd', 'repwd'),


A set of validators for reactive forms, including:

  • _Validators.num Wheter is number

  • Wheter is integer

  • _Validators.decimal Wheter is decimal

  • _Validators.idCard Wheter is People's Republic of China identity card

  • Wheter is mobile (China)

  • _Validators.url Wheter is url address

  • _Validators.ip4 Wheter is IP address (Support v4, v6)

  • _Validators.color Wheter is color

  • _Validators.chinese Wheter is chinese

Every method has a corresponding form validation:

this.valForm ={
  // is mobile
  mobile: [null, Validators.compose([Validators.required,])]