import { Attribute, Component, Inject, Optional, NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; // #docregion @Component({ selector: 'hero-title', template: `

{{titlePrefix}} {{title}}

{{ msg }}

` }) class TitleComponent { private msg: string = ''; constructor( @Inject('titlePrefix') @Optional() private titlePrefix: string, @Attribute('title') private title: string) { } ok() { this.msg = 'OK!'; } } // #enddocregion @Component({ selector: 'hero-di-inject-additional', template: ` ` }) class AppComponent { } @NgModule({ imports: [ BrowserModule ], declarations: [ AppComponent, TitleComponent ], bootstrap: [ AppComponent ] }) export class HeroesDIInjectAdditionalModule { }