Search code examples
angulartypescriptionic4

Can't bind to 'countUp' since it isn't a known property of 'h1'. countup.js-angular2


I want to have a countup in one of my components... using countup.js-angular2

As in the gitup repo, i did everything i was suppose to do, it is still not working

import { CountUpModule } from 'countup.js-angular2';

@NgModule({
    declarations: [AppComponent],
    entryComponents: [],
    imports: [
        .....,
        CountUpModule
    ],
})

html 
<h1 [countUp]="endVal">0</h1>

typescript
endVal: number = 100;

Error -

Can't bind to 'countUp' since it isn't a known property of 'h1'.


Solution

  • Looking at the docs they seem to be missing the fact that Ionic uses lazy loading and each page is also a module.

    Add the module to your (pagename).module.ts file as well, using the same way as the app.module.ts.