ngOnInit(): void {
this.validateForm = this.formBuilder.group({
from_name: ['', Validators.required],
from_companyName: [''],
from_email: ['', [Validators.pattern(this.emailRegex), Validators.maxLength(49)]],
from_phone: [''],
from_address1: ['', [Validators.required, Validators.maxLength(39)]],
from_address2: ['', Validators.maxLength(39)],
from_suburb: ['', [Validators.required]],
from_country: ['', Validators.required],
from_state: ['', Validators.required],
from_postcode: ['', [Validators.required, postcodeValidator()]],
});
//监听数据变化
this.validateForm.valueChanges.subscribe(data => console.log('form', data));
//监听状态变化
this.validateForm.statusChanges.subscribe(data => console.log('status', data));
}
