angular - 无法绑定(bind)到 'countUp',因为它不是 'h1' 的已知属性。 countup.js-angular2

标签 angular typescript ionic4

我想在我的一个组件中进行计数...使用 countup.js-angular2

在 gitup 仓库中,我做了我应该做的一切,它仍然没有工作

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

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

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

typescript
endVal: number = 100;

错误-

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

最佳答案

寻找 at the docs他们似乎忽略了 Ionic 使用延迟加载并且每个页面也是一个模块这一事实。

将模块添加到您的 (pagename).module.ts 文件中,使用与 app.module.ts 相同的方式。

关于angular - 无法绑定(bind)到 'countUp',因为它不是 'h1' 的已知属性。 countup.js-angular2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58168597/

相关文章:

html - 无法分配给类型错误的 Angular BehaviourSubject 问题

reactjs - 设置 PROPS 类型的正确方法是什么?

html - 如何将标签或段落准确地放置/绑定(bind)到元素顶部?

Angular 绑定(bind)到函数结果

angular - 在 ngconf2015demo 上执行 tsc 时出错 - 缺少 tsd.d.ts

ios - 使用 ionic 媒体插件在 IOS 上录制语音笔记不起作用

angular - 无法读取 Ionic 4 和 Angular 8 上未定义的属性 'subscribe'

javascript - 在node.js中创建带有命名空间的模块

typescript - Redux + typescript : Types of parameters 'action' and 'action' are incompatible

ionic-framework - 用于 OTP 验证的 Ionic 4 读取 SMS 插件