bug(data-table): data source connect not called when using router
See original GitHub issueBug, feature request, or proposal:
I have copied the exact demo from ‘material-examples’ into a plunker and have loaded the TableBasicExample
component via a router. When navigating to the router (via button in toolbar on plunkr), the table does not display correctly. When clicking that button again, it works. In my own application I have tested by including logging in the connect()
method of the data source. It does not get called on initial navigation to the route, but it does when you navigate the second time
One resolution I have used is to perform the dataSource initialization in a setTimeout(1), which solves the issue, but I do not believe that this should be the solution.
What is the expected behavior?
The data source connect method should be called after navigating to page via router
What is the current behavior?
The data source connect method is not called
What are the steps to reproduce?
http://plnkr.co/edit/RRVoUV9SBAxozY6VhvpA?p=preview
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
latest master, and beta8
Issue Analytics
- State:
- Created 6 years ago
- Reactions:23
- Comments:9
Top GitHub Comments
Same here.
When calling changeDetector.detectChanges after setting the DataSource to manually trigger ChangeDetection the Table will show up.
http://plnkr.co/edit/Soc0n4ak80VKdZ27htVU?p=preview
I can confirm this hack is not necessary anymore with beta10.