Reputation: 21104
As per below image, say I've got two @Component
(s):
Both are ContainerComponent
children.
MenuComponent
fires an event (via EventEmitter
) to "say" we want all the table rows selected. This event is catched at the ContainerComponent
level.
What's the better strategy to let TableComponent
know that it has to select all the rows of its table?
I could use the @ViewChild
strategy, but I don't like direct components access. Any other idea?
Upvotes: 0
Views: 41
Reputation:
Keep it simple
<app-container>
<app-menu #menu (selectAllRows)="table.selectAllRows($event)">
</app-menu>
<app-table #table>
</app-table>
</app-container>
Upvotes: 1