There was a problem with nested observables:
I have the correct plan number, btw all wariable are well configured, I see in the console that the number of statuses is growing ...
but the combo box is empty, what am I doing wrong?
Here is the code snippet that I have in my template:
<tr *ngFor="let plan of plans$ | async">
<td><input type="text" [(ngModel)]="plan.libelle"/></td>
<td>
<select>
<option *ngFor="let statut of statuts$ | async"
ngValue="{{statut.id}}"
[selected]="statut.id == plan.statut.id">
{{statut.libelle}}
</option>
</select>
</td>
</tr>
different in my component:
private plans$:Observable<Array<Plan>>;
private statuts$:Observable<Array<Param>>;
constructor(private planService:PlanService, private paramService:ParamService) {}
ngOnInit() {
this.statuts$ = this.paramService.typesPlan$;
this.plans$ = this.planService.plans$;
this.paramService.loadAll('plan');
this.planService.loadAll();
}
As a result, I have a table with my plans, but in the same line the combo is empty: there is no choice in the combo (does the asynchronous mode not work?) It looks like the template does not update when the status $ is updated
Thanks for the help!
source
share