Reputation: 17108
I have an Array of a component as below
<ng-container [ngTemplateOutlet]="controlArrayContainer"
[ngTemplateOutletContext]="{controls:control?.componentProperty?.formArray, index: i}">
</ng-container>
Passing the data from the context as
{controls:control?.componentProperty?.formArray, index: i}
In the template section consuming the data as below
<ng-template #controlArrayContainer let-control="controls" let-index="index">
<ng-container *ngFor="let layout of controls; let i = index">
</ng-container>
</ng-template>
Keep getting an exception during the compile time as
Error: projects/falcon-core/src/lib/component/reactive-controls/reactive-controls.component.html:32:41 - error TS2339: Property 'controls' does not exist on type 'ReactiveControlsComponent'.
32 <ng-container *ngFor="let layout of controls; let i = index">
Upvotes: 0
Views: 2847
Reputation: 799
In your code, you are using let-control
, so you should use control
in the ngFor
loop, instead of controls
:
<ng-template #controlArrayContainer let-control="controls" let-index="index">
<ng-container *ngFor="let layout of control; let i = index">
</ng-container>
</ng-template>
Upvotes: 1