我正在尝试使用ng-select反应形式验证输入字段。由于某些原因,不会为无效输入添加ng-invalid CSS类
<form [formGroup]="heroForm" (ngSubmit)="onSubmit()">
<div class="form-group">
<label for="age">Single select</label>
<ng-select
[items]="dropdownList"
[selectOnTab]="true"
bindValue="firstname"
bindLabel="firstname"
placeholder="Select age"
formControlName="age">
</ng-select>
<button type="submit" class="btn btn-sm btn-secondary">Submit Form</button>
heroForm: FormGroup;
constructor(private fb:FormBuilder){}
ngOnInit() {
this.heroForm = this.fb.group({
age: [null, Validators.required]
});
}