表单:表单组;
createMyForm() {
this.form = new FormGroup<any>({
firstName: new FormControl<any>('', [Validators.required]),
lastName: new FormControl<any>('', { nonNullable: true }),
});
}
Run Code Online (Sandbox Code Playgroud)
如何将 { nonNullable: true } 添加到firstName
我正在尝试将 {nonNullable: true } 添加到表单控件。
姓氏:新 FormControl('', { nonNullable: true }),
我可以将 {nonNullable: true } 添加到没有验证的控件,但对于有验证的表单控件,我无法添加 {nonNullable: true }。
名字:new FormControl('', [Validators.required]),
angular14 ×1