import {
Attribute,
Component,
ElementRef,
Inject,
Optional,
Query,
QueryList
} from 'angular2/core';
// #docregion
@Component({
selector: 'hero-title',
template: `
{{titlePrefix}} {{title}}
`
})
export class TitleComponent {
constructor(
@Inject('titlePrefix')
@Optional()
private titlePrefix:string,
@Attribute('title')
private title:string,
@Query('okMsg')
private msg:QueryList) {
}
ok() {
let msgEl =
this.msg.first.nativeElement;
msgEl.textContent = 'OK!';
}
}
// #enddocregion
@Component({
selector: 'hero-di-inject-additional',
template: `
`,
directives: [TitleComponent]
})
export class AppComponent {
}