Skip to main content
InterviewHubPRO
Section Overview
Q210

Question 210 of 283

Part 8: Internationalization (i18n), Testing & DOM Directives (177 - 212)

74%
Angular Master (283 Qs)•Part 8: Internationalization (i18n), Testing & DOM Directives (177 - 212)

Is mandatory to pass static flag for ViewChild?

mid LevelCode ExampleDirectivesTesting

In Angular 8, the static flag is required for ViewChild. Whereas in Angular9, you no longer need to pass this property. Once you updated to Angular9 using ng update, the migration will remove { static: false } script everywhere.

javascript
@ViewChild(ChildDirective) child: ChildDirective; // Angular9 usage
@ViewChild(ChildDirective, { static: false }) child: ChildDirective; //Angular8 usage