2016-10-13 17:59:00 +01:00
|
|
|
import {
|
|
|
|
Attribute,
|
|
|
|
Component,
|
|
|
|
Inject,
|
|
|
|
Optional,
|
|
|
|
NgModule
|
|
|
|
} from '@angular/core';
|
|
|
|
import { BrowserModule } from '@angular/platform-browser';
|
|
|
|
|
|
|
|
// #docregion
|
|
|
|
class TitleComponent {
|
|
|
|
constructor(titlePrefix, title) {
|
|
|
|
this.titlePrefix = titlePrefix;
|
|
|
|
this.title = title;
|
|
|
|
this.msg = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
ok() {
|
|
|
|
this.msg = 'OK!';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-11 19:44:00 -08:00
|
|
|
// #docregion metadata
|
2016-10-13 17:59:00 +01:00
|
|
|
TitleComponent.annotations = [
|
|
|
|
new Component({
|
2016-11-11 19:44:00 -08:00
|
|
|
moduleId: module.id,
|
2016-10-13 17:59:00 +01:00
|
|
|
selector: 'hero-title',
|
2016-11-11 19:44:00 -08:00
|
|
|
templateUrl: 'title.component.html'
|
2016-10-13 17:59:00 +01:00
|
|
|
})
|
|
|
|
];
|
2016-11-11 19:44:00 -08:00
|
|
|
// #enddocregion metadata
|
2016-10-13 17:59:00 +01:00
|
|
|
|
|
|
|
TitleComponent.parameters = [
|
|
|
|
[new Optional(), new Inject('titlePrefix')],
|
|
|
|
[new Attribute('title')]
|
|
|
|
];
|
|
|
|
// #enddocregion
|
|
|
|
|
|
|
|
class AppComponent {
|
|
|
|
}
|
|
|
|
AppComponent.annotations = [
|
|
|
|
new Component({
|
|
|
|
selector: 'hero-di-inject-additional',
|
|
|
|
template: `<hero-title title="Tour of Heroes">
|
|
|
|
</hero-title>`
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
export class HeroesDIInjectAdditionalModule { }
|
|
|
|
|
|
|
|
HeroesDIInjectAdditionalModule.annotations = [
|
|
|
|
new NgModule({
|
|
|
|
imports: [ BrowserModule ],
|
|
|
|
declarations: [
|
|
|
|
AppComponent,
|
|
|
|
TitleComponent
|
|
|
|
],
|
|
|
|
bootstrap: [ AppComponent ]
|
|
|
|
})
|
|
|
|
];
|