, . Angular javascript, , {{ number }}
ng-template
number
*ngFor
, , , <ng-container>
.
number
AppComponent
, number = 42
, , {{number}}
<ng-template>
42
.
So, either you have to define your templates inside the area *ngFor
where the variable number
has the required value, or somehow pass this value to both even_tpl
, and odd_tpl
. As @Vivek pointed out, you can do this with ngTemplateOutlet
and ngTemplateOutletContext
.
source
share