Skip to content
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

Merged
merged 1 commit into from Mar 15, 2019

Conversation

Projects
None yet
4 participants
@andrewseguin
Copy link
Contributor

andrewseguin commented Mar 14, 2019

Adds {static: true} to any queries in our examples where the query is used in ngOnInit

@andrewseguin andrewseguin requested a review from mmalerba Mar 14, 2019

@andrewseguin andrewseguin requested a review from jelbourn as a code owner Mar 14, 2019

@googlebot googlebot added the cla: yes label Mar 14, 2019

@@ -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;

This comment has been minimized.

@crisbeto

crisbeto Mar 14, 2019

Member

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.

This comment has been minimized.

@andrewseguin

andrewseguin Mar 14, 2019

Author Contributor

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.

This comment has been minimized.

@crisbeto

crisbeto Mar 14, 2019

Member

I see, although it's a little unfortunate that we have to require people to use static queries.

@crisbeto
Copy link
Member

crisbeto left a comment

LGTM

@mmalerba mmalerba merged commit d525f9c into angular:master Mar 15, 2019

12 checks passed

branch-manager Checked 1 branch — 7.3.x: success
Details
ci/angular: merge status All checks passed!
ci/circleci: api_golden_checks Your tests passed on CircleCI!
Details
ci/circleci: bazel_build_test Your tests passed on CircleCI!
Details
ci/circleci: build_devapp_aot Your tests passed on CircleCI!
Details
ci/circleci: build_release_packages Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: prerender_build Your tests passed on CircleCI!
Details
ci/circleci: tests_browserstack Your tests passed on CircleCI!
Details
ci/circleci: tests_local_browsers Your tests passed on CircleCI!
Details
ci/circleci: tests_saucelabs Your tests passed on CircleCI!
Details
cla/google All necessary CLAs are signed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.