I have a form include 3 dropdowns, this dropdown get their data from API The problem is the dropdown does not bind data if I don't click on dropdown (blur on any filed in form )
my HTML
<form [formGroup]="dropdownsForm" novalidate class="needs-validation">
<div class="dropdown">
<select class="form-control" formControlName="CountryName"
[attr.data-live-search]="true" style="width: 150px;" >
<option *ngFor="let Country of allCountrys" [value]="Country.id">
{{Country.title}}</option>
</select>
</div>
</form>
My ts
allCountrys: DropDownListForLkpsDto[];
constructor(
private fb: FormBuilder,
private _countryService: CountryServiceProxy
) {
}
ngOnInit(): void {
this.dropdownsForm = this.fb.group(
{
CountryName: [""],
}
);
this._countryService.getAllCountrysForDDl().subscribe(result => {
this.allCountrys = result;
});
}
After 3 days of search, we finally find the issue
in my ts file, I have this line
changeDetection: ChangeDetectionStrategy.OnPush
into my
@Component({ })
when we remove changeDetection line it works fine