Error: View Container not found! ngUpgrade needs to manually set this via setRootViewContainer or setGlobalRootViewContainer.
See original GitHub issueDescribe the bug
If have an angular 9 app running with ngUpgrade in usage. Since the upgrade from angular 8.2.14 to 9.1.2 and ngx-charts 12.0.1 to 14.0.0 the error
Error: View Container not found! ngUpgrade needs to manually set this via setRootViewContainer or setGlobalRootViewContainer.
is thrown, when hovering over a line chart.
Expected behavior The chart shall not throw an exception.
Screenshots
ngx-charts version 14.0.0
Additional context If this is not a bug a description of how to fix this would be really helpful.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10
Top Results From Across the Web
Angular2 Dynamic Component Injection in Root - Stack Overflow
... return rootComponents[0]; throw new Error('View Container not found! ngUpgrade needs to manually set this via setRootViewContainer.
Read more >Angular Debugging "Expression has changed": Explanation ...
We are going to give a complete explanation about this error. We will learn why it occurs, how to debug it consistently and...
Read more >Preparing for the Angular 1 8 Upgrade in Primo - YouTube
Preparing for the Angular 1 8 Upgrade in Primo - Americas and EMEA. 307 views 4 months ago. ExLibrisLtd. ExLibrisLtd. 3.11K subscribers.
Read more >Upgrading from AngularJS to Angular
The upgrade module in Angular has been designed to make incremental ... This not only makes components easy to navigate and find, but...
Read more >swimlane/ngx-graph - Gitter
I tried to change the svg.ngx-charts { cursor: pointer} in my component's css ... I'm styling light theme, but I can not change...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks @medi6 , this removes the error indeed. Working with a base component, it was enough to only pass the viewContainerRef.
Hi, after spending a little time on it, I’ve got a solution.
1/ inject TooltipService in your component
import {TooltipService} from '@swimlane/ngx-charts';
2/ In component’s constructor add :private chartToolTipService : TooltipService, private viewContainerRef: ViewContainerRef
3/ set the ViewContainerRef in ngOnInit. You can use the ViewContainerRef of your component, but It’s better to use your root ViewContainerRef because of superpositions errors. In my case (ngUpgrade) It’s a little more complicated :
this.chartToolTipService.injectionService.setRootViewContainer(this.parentContainer||this.coreServicesProvider.mainViewService.mainViewContainer||this.viewContainerRef);
And it works.