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