我有一个正在创建的表格。我遇到的问题是从组件而不是输入中验证值。我将如何去做?
public project = this.fb.group({
agent: ['', Validators.required],
lockbox: [''],
notes: [''],
owners: [''],
scheduledFor: ['', Validators.required],
address: this.fb.group({
street: ['', Validators.required],
city: ['', Validators.required],
state: ['', Validators.required],
zip: ['', Validators.required]
}),
});
<form [formGroup]="project" (ngSubmit)="add(project.value)">
<!--other stuff-->
<label>
scheduledFor:
<!-- <input type="text" formControlName="scheduledFor" required> -->
<ngbd-datepicker-basic (messageEvent)="receiveDate($event)" formControlName="scheduledFor" required></ngbd-datepicker-basic>
</label>
<!--other stuff-->
<button type="submit" [disabled]="!project.valid">Submit</button>
</form>