2
Ich verwende das reaktive Formular. Ich möchte Validator von Formcontrol in Sicht wie folgt erhalten:So erhalten Sie den FormControl-Validator in der HTML-Ansicht
<span *ngIf="productForm.controls.ProductName.validator?.required" class="required-field">*</span>
Mein Komponentencode ist wie folgt:
this.productForm = new FormGroup({
'ProductName': new FormControl('', [Validators.required])
})
Gibt es eine Möglichkeit zu sehen wissen, dass Product einen Validator haben und was erforderlich ist,