Skip to content

Instantly share code, notes, and snippets.

@alexzuza
Created March 19, 2018 19:42
Show Gist options
  • Save alexzuza/eb1bcaaf04443f9ebc484254d0b84026 to your computer and use it in GitHub Desktop.
Save alexzuza/eb1bcaaf04443f9ebc484254d0b84026 to your computer and use it in GitHub Desktop.
DI simple application
@Component({
selector: 'my-app',
template: `<child></child>`,
})
export class AppComponent {}
@Component({
selector: 'child',
template: `<grand-child></grand-child>`
})
export class ChildComponent {}
@Component({
selector: 'grand-child',
template: `grand-child`
})
export class GrandChildComponent {
constructor(private service: Service) {}
}
@NgModule({
imports: [BrowserModule],
declarations: [
AppComponent,
ChildComponent,
GrandChildComponent
],
bootstrap: [AppComponent]
})
export class AppModule { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment