CATcher-org / CATcher-org/CATcher

Follow recommended practice for ViewChild

Open
#773 5 comments 0 reactions 0 assignees View on GitHub
aspect-CodeQuality p.Medium
Dominant language
TypeScript
Stars
92
Forks
85
PR merge metrics
No merged PRs in 30d

Description

A new `static` flag has been added to `ViewChild` starting from Angular 8.0.
This flag should be `false` by default, if we follow Angular's recommended practice of using `ngAfterViewInit()` for view queries for `ViewChild`. (Please refer to: https://angular.io/guide/static-query-migration)

![image](https://user-images.githubusercontent.com/66008784/132301924-3b12bc5d-b915-47c8-96db-21bd111ac3db.png)

From Angular 9.0, the `static` flag will be removed for default value `false`. We should aim to revert to the best practice ideally before upgrading to Angular 9.0.

## Summary:
Let's follow the recommended practice of using `ngAfterViewInit()` for `ViewChild` view queries.

**More details about the change found in Angular upgrade pull request

Contributor guide

No contributing guide indexed for this repository

Research direction

Search the project for ViewChild queries and check how each is used relative to ngAfterViewInit(), using the Angular static-query migration guidance linked in the issue as the starting point. Done means the relevant view queries follow the recommended false-static behavior and the application still works correctly before an Angular 9 upgrade.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.