Hi,
Can I do this?
<div class="col" *ngFor="let col of line">
<childcomponent " [icol]="{{col}}"></childcomponent>
</div>
And in the child component
@Input() icol
;
Hi,
Can I do this?
<div class="col" *ngFor="let col of line">
<childcomponent " [icol]="{{col}}"></childcomponent>
</div>
And in the child component
@Input() icol
;
Could you try <childcomponent [icol]=" '{{col}}' "></childcomponent>
No, that is not how property binding is done.
Property binding means that it expects a value to be set in the class.
so when you do {{col}}
, it will literally expect this.{{col}}
to be in your class, which it cannot.
Instead, you do [icol]="col"
, and have this.col
That’s it. I tried and it is working perfectly. Thanks.