无法绑定到 'countUp',因为它不是 'h1' 的已知 属性。 countup.js-角度2
Can't bind to 'countUp' since it isn't a known property of 'h1'. countup.js-angular2
我想在我的一个组件中进行计数...使用 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'.
试试这个:
<h1 countUp [endVal]="endVal">0</h1>
countUp 是一个指令,它不应该在方括号中。
此致
看起来 at the docs 他们似乎忽略了 Ionic 使用延迟加载并且每个页面也是一个模块的事实。
也将模块添加到您的 (pagename).module.ts 文件,使用与应用程序相同的方式。module.ts.
视版本而定,本期https://github.com/inorganik/ngx-countUp/issues/43说的是版本冲突
卸载 npm uninstall countup.js-angular2
旧版本即可。
countup.js-angular2@6.0.2
[endVal]
也可以。
我想在我的一个组件中进行计数...使用 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'.
试试这个:
<h1 countUp [endVal]="endVal">0</h1>
countUp 是一个指令,它不应该在方括号中。
此致
看起来 at the docs 他们似乎忽略了 Ionic 使用延迟加载并且每个页面也是一个模块的事实。
也将模块添加到您的 (pagename).module.ts 文件,使用与应用程序相同的方式。module.ts.
视版本而定,本期https://github.com/inorganik/ngx-countUp/issues/43说的是版本冲突
卸载 npm uninstall countup.js-angular2
旧版本即可。
countup.js-angular2@6.0.2
[endVal]
也可以。