Cannot read property 'nativeElement' of undefined when View is undefined
See original GitHub issueI’m submitting a … (check one with “x”)
[X ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here
Current behavior I’m using the latest version of ngx-charts with Angular 4.0.0 and I get an error when trying to set view to undefined to get the chart at parent’s div dimensions.
ChartWindowComponent.html:52 ERROR TypeError: Cannot read property 'nativeElement' of undefined at LineChartComponent../src/common/base-chart.component.ts.BaseChartComponent.getContainerDims (index.js:9031) at LineChartComponent../src/common/base-chart.component.ts.BaseChartComponent.update (index.js:9015) at LineChartComponent../src/line-chart/line-chart.component.ts.LineChartComponent.update (index.js:14596) at LineChartComponent../src/common/base-chart.component.ts.BaseChartComponent.ngOnChanges (index.js:9004)
Expected behavior Just get the chart to fit to the parent container size.
- ngx-charts version: 5.1.2
- Angular version: 4.0.0
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:20 (3 by maintainers)
Top GitHub Comments
I don’t know if you guy had resolved this issue: MatSelect.html:1 ERROR TypeError: Cannot read property ‘nativeElement’ of undefined. I found a solution by setTimeOut and waited for all view init.
It worked for me perfectly!
you should use ngAfterviewInit(){ } instead of timeout()