inorganik / ngx-countUp

Animates a numerical value by counting to it - for Angular

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Angular 7 and Ionic 4 Problem

Crypt0Graphic opened this issue · comments

Animation does not work in ionic/angular project. Just shows static number.

Angular 7.2.12, Ionic 4.2.0

Console Error:

ERROR TypeError: Cannot read property 'reset' of undefined
    at CountUpDirective.push../node_modules/countup.js-angular2/fesm5/countup.js-angular2.js.CountUpDirective.animate (countup.js-angular2.js:59)
    at CountUpDirective.push../node_modules/countup.js-angular2/fesm5/countup.js-angular2.js.CountUpDirective.onClick (countup.js-angular2.js:28)
    at Object.eval [as handleEvent] (PrepHomePage.html:51)
    at handleEvent (core.js:23107)
    at callWithDebugContext (core.js:24177)
    at Object.debugHandleEvent [as handleEvent] (core.js:23904)
    at dispatchEvent (core.js:20556)
    at core.js:21003
    at HTMLHeadingElement.<anonymous> (platform-browser.js:993)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)

So this.countUp in count-up.directive.ts never got created. Can you paste the markup which uses the directive?

You might try updating, I recently pushed a bugfix in v7.1.1.

@Crypt0Graphic please let me know if 7.1.1 fixes

7.2.0 is working for me with Angular 8, but I'm not using Ionic-

Now working,

Add Module in both app.module.ts and the component you want to use it...

Mine is result.module.ts

Answered by Stackoverflow

https://stackoverflow.com/questions/58168597/cant-bind-to-countup-since-it-isnt-a-known-property-of-h1-countup-js-angu/58170883#58170883

Closing this since the answer above is the solution. Thanks @I-am-abdulazeez