-
Notifications
You must be signed in to change notification settings - Fork 26.7k
Closed
Labels
area: coreIssues related to the framework runtimeIssues related to the framework runtimecore: queriesneeds reproductionThis issue needs a reproduction in order for the team to investigate furtherThis issue needs a reproduction in order for the team to investigate furtherregressionIndicates than the issue relates to something that worked in a previous versionIndicates than the issue relates to something that worked in a previous version
Milestone
Description
🐞 bug report
Affected Package
@angular/core
Is this a regression?
Yes, the previous version 8 worked
Description
When using template ref in ngSwitch container in any life cycle of component ViewChild is always undefined
🔬 Minimal Reproduction
🔥 Exception or Error
ts:
@ViewChild('tip', { static: false })
public tip: NgbTooltip;
modeEnum: typeof GuiStatus = GuiStatus;
mode = GuiStatus.VIEW;
ngOnInit(): void {
console.log('ngOnInit:tip', this.tip);
}
ngOnChanges(_changes: SimpleChanges): void {
console.log('ngOnChanges:tip', this.tip);
}
ngAfterViewInit(): void {
console.log('ngAfterViewInit:tip', this.tip);
}
html:
<ng-container [ngSwitch]="mode">
<ng-container *ngSwitchCase="modeEnum.VIEW">
<i class="fas fa-info-circle text-primary"
style="cursor:pointer"
#tip="ngbTooltip"
[ngbTooltip]="tipSource"
tooltipClass="info-tooltip"></i>
</ng-container>
</ng-container>
log:
ngOnChanges:tip undefined
ngOnInit:tip undefined
ngAfterViewInit:tip undefined
🌍 Your Environment
Angular Version:
Angular CLI: 9.0.6
Node: 12.6.0
OS: win32 x64
Angular: 9.0.6
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router
Ivy Workspace: Yes
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.900.6
@angular-devkit/build-angular 0.900.6
@angular-devkit/build-optimizer 0.900.6
@angular-devkit/build-webpack 0.900.6
@angular-devkit/core 9.0.6
@angular-devkit/schematics 9.0.6
@ngtools/webpack 9.0.6
@schematics/angular 9.0.6
@schematics/update 0.900.6
rxjs 6.5.4
typescript 3.7.5
webpack 4.41.2
Anything else relevant?
Metadata
Metadata
Assignees
Labels
area: coreIssues related to the framework runtimeIssues related to the framework runtimecore: queriesneeds reproductionThis issue needs a reproduction in order for the team to investigate furtherThis issue needs a reproduction in order for the team to investigate furtherregressionIndicates than the issue relates to something that worked in a previous versionIndicates than the issue relates to something that worked in a previous version