Ultimate goal is to use nested ngFor's created dynamically.
I try to create a series of drop-down menus, each depending on the previous one. The exact number of drop-down menus is unknown and created dynamically. Example:
<form [ngFormModel]="dropDownForm" (ngSubmit)="onSubmit()">
<div *ngFor="#nr of numberOfDropdowns">
<label>{{nr.name}}</label>
<select [ngFormControl]="dropDownForm.controls[i]">
<option *ngFor="#item of Dropdown[nr.id] | async" value="{{item.value}}">{{item.name}}</option>
</select>
</div>
<button type="submit">Submit</button>
</form>
The whole things fails at Dropdown[nr.id] which does not seem to work with async pipe.
I played around a bit:
{{myAsyncObject | async}} //works
{{myAsyncObject['prop1'] | async}} //fails silently
{{myAsyncObject['prop1']['prop2'] | async}} // EXCEPTION: TypeError: Cannot read property 'prop2' of undefined in [null]
Any ideas on how to get this working?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…