-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
canvas ElementRef undefined within Angular 9 application #28
Comments
Almost the same here. |
I tried to fix this by forking the project and upgrading to Angular 9, but just couldn't get it to compile locally. So I resorted to pulling in the files into my project, The only change I needed to make to get it working with Angular 9 was changing this line in the Base Guage class... @ViewChild('gauge', { static: true }) This means that it is resolved before change detection runs so is not undefined within ngOnInit (the location of the problem). By default, static is set to false, so you'd need to move the ngOnInit code into ngAfterViewInit. Hope this helps. It worked for me in the interim. |
in the meanwhile you can download the Version for angular 9.x on.. |
Did you check if the animation is working fine in Angular 9.0? I am using Angular 10 I encounter the same issue, So I used your version of it and worked. But seems like animation is still broken. |
Hey I was trying to install your fork but there are some dependencies errors:
Ionic info:
|
Have updated my application to Angular 9.
Making use of the radial gauge.
Seeing this error:
DamageGaugeComponent.html:2 ERROR TypeError: Cannot read property 'nativeElement' of undefined
at RadialGauge$1.get options [as options] (ng-canvas-gauges.js:62)
at RadialGauge$1.ngOnInit (ng-canvas-gauges.js:305)
at checkAndUpdateDirectiveInline (core.js:32904)
at checkAndUpdateNodeInline (core.js:45701)
at checkAndUpdateNode (core.js:45640)
at debugCheckAndUpdateNode (core.js:46663)
at debugCheckDirectivesFn (core.js:46606)
at Object.eval [as updateDirectives] (DamageGaugeComponent.html:2)
at Object.debugUpdateDirectives [as updateDirectives] (core.js:46594)
at checkAndUpdateView (core.js:45605)
It appears that the protected canvas: ElementRef; is not being set and is therefore undefined.
I'm wondering whether this needs to be updated to use the new static flag with ViewChild.
The text was updated successfully, but these errors were encountered: