-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(table): use static queries for examples #15483
fix(table): use static queries for examples #15483
Conversation
@@ -27,8 +30,8 @@ export class TableOverviewExample implements OnInit { | |||
displayedColumns: string[] = ['id', 'name', 'progress', 'color']; | |||
dataSource: MatTableDataSource<UserData>; | |||
|
|||
@ViewChild(MatPaginator) paginator: MatPaginator; | |||
@ViewChild(MatSort) sort: MatSort; | |||
@ViewChild(MatPaginator, {static: true}) paginator: MatPaginator; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't we move the usages to ngAfterViewInit
, rather than marking them as static
? Since it's an example it won't be a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue with the table is that it needs the paginator and sort to figure out the initially rendered rows before initialization. If we wait until after view init, the table will initially render all rows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, although it's a little unfortunate that we have to require people to use static queries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Adds
{static: true}
to any queries in our examples where the query is used in ngOnInit