angular(formGroup)

/*在form表单中使用formGroup定义一个名称*/ 查询开始时间 查询结束时间 >

  

import { FormGroup, FormBuilder, AbstractControl , FormControl } from '@angular/forms';/*导入FormGroup等*/

constructor(
private formBuilder: FormBuilder/*将FormBuilder注册*/
) {
this.nav = 0;
this.searchForm = this.formBuilder.group({/*定义字段*/
startPicker: '',
endPicker: ''
});
}
get startPicker(): AbstractControl {
        return this.searchForm.get('startPicker');
    }

    get endPicker(): AbstractControl {
        return this.searchForm.get('endPicker');
    }/*获取定义字段数据*/

  

  

转载于:https://www.cnblogs.com/cx19950223/p/11635046.html

你可能感兴趣的:(angular(formGroup))