tRefVar is {{tRefVar.foo}}
Even though the
As given in the above answer by @lexith, Because you're using *ngIf
the corresponding template variable is not defined at the time. We can avoid this confusion by modifying the code
with
and that will work.
Final code:
@Component({
selector: 'my-app',
template: `
Hello {{name}}, tRefVar is {{tRefVar.foo}}
tRefVar is {{tRefVar?.foo}}
`,
})
Modified Plunker