In my application, I have defined some component, that takes two variables: start
and end
. I run it in ngFor
as follows:
<template ngFor #exampleData [ngForOf]="data" #idx="index">
<div>
<example-component start="exampleData.star" end="exampleData.end" *ngIf="exampleData.start" ></example-component>
</div>
</template>
You can see this in the plnkr
As you can see, this code provides example-component
with a string of either exampleDate.start
or exampleData.end
.
It will run as intended when I will add expression into the component like that:
<template ngFor #exampleData [ngForOf]="data" #idx="index">
<div>
<example-component start="{{exampleData.star}}" end="{{exampleData.end}}" *ngIf="exampleData.start" ></example-component>
</div>
</template>
My question is: why is that?