Given the Angular 2 component:
import { Component } from '@angular/core';
@Component({
moduleId: module.id,
selector: 'app-root',
styleUrls: ['app.component.css']import { Component } from '@angular/core';
@Component({
moduleId: module.id,
selector: 'app-root',
template: '<div ref-title>{{title}}</div>',
})
export class AppComponent {
title = 'app works!';
}
you get this on the webpage:
[object HTMLDivElement]
The reason is that Template Reference Variable ref-title shadows the title of AppComponent when evaluating {{title}}.
I guess this is sort of like the loop variables inside an
<li *ngFor="let title in titles">{{title}}</li>
But something does not feel right about TRV.
No comments:
Post a Comment