【问题标题】:ng-lottie and ngx-lottie is not working in ionic-5ng-lottie 和 ngx-lottie 在 ionic-5 中不起作用
【发布时间】:2021-10-25 01:47:24
【问题描述】:

我正在将 lottie 飞溅动画集成到 ionic 5 框架中的组件中。

我已经使用 npm install --save ng-lottie 安装了 ng-lottie,并按照文档 https://www.npmjs.com/package/ng-lottie 中的步骤进行操作。但是,它显示以下错误。请帮我解决这个问题。

Uncaught Error: Template parse errors:
Can't bind to 'options' since it isn't a known property of 'lottie-animation-view'.
1. If 'lottie-animation-view' is an Angular component and it has 'options' input, then verify that it is part of this module.
2. If 'lottie-animation-view' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("

<lottie-animation-view
                    [ERROR ->][options]="lottieConfig"
                    [width]="300"
                    [height]="600"
"): ng:///SsoModule/SsoComponent.html@13:20
Can't bind to 'width' since it isn't a known property of 'lottie-animation-view'.

【问题讨论】:

  • 我认为 ng-lottie 不应该与 Ionic 中的最新 Angular 一起使用。你应该切换到 ngx-lottie。

标签: ionic5


【解决方案1】:

您还必须在 '.module.ts 组件中导入 LottieModule

@NgModule({
  imports: [
   ***,
    LottieModule
  ],

【讨论】:

    【解决方案2】:

    当您在 app.module.ts 中而不是在您的 module.ts 中添加依赖项时,此错误很常见。 尝试改变依赖关系。

    【讨论】:

      猜你喜欢
      • 2021-02-23
      • 1970-01-01
      • 1970-01-01
      • 2019-10-27
      • 1970-01-01
      • 2022-07-19
      • 2022-07-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多