, . 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 *ngForwhere the variable numberhas the required value, or somehow pass this value to both even_tpl, and odd_tpl. As @Vivek pointed out, you can do this with ngTemplateOutletand ngTemplateOutletContext.
source
share