Skip to content

Instantly share code, notes, and snippets.

@alexzuza
Last active March 20, 2018 05:15
Show Gist options
  • Save alexzuza/da48a6d59845c3d402c1d350a6bfb066 to your computer and use it in GitHub Desktop.
Save alexzuza/da48a6d59845c3d402c1d350a6bfb066 to your computer and use it in GitHub Desktop.
DI view parent element hierarhy
@Component({
selector: 'my-app',
template: `<my-list></my-list>`
})
export class AppComponent {}
@Component({
selector: 'my-list',
template: `
<div class="container">
<grid-list>
<grid-tile>1</grid-tile>
<grid-tile>2</grid-tile>
<grid-tile>3</grid-tile>
</grid-list>
</div>
`
})
export class MyListComponent {}
@Component({
selector: 'grid-list',
template: `<ng-content></ng-content>`
})
export class GridListComponent {}
@Component({
selector: 'grid-tile',
template: `...`
})
export class GridTileComponent {
constructor(private gridList: GridListComponent) {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment