【问题标题】:@grapecity/wijmo throwing run time error after upgrading my Angular project from 8 to 9@grapecity/wijmo 在将我的 Angular 项目从 8 升级到 9 后抛出运行时错误
【发布时间】:2020-11-04 07:34:38
【问题描述】:

最近我正在尝试将我的 Angular 项目从 8 更新到 9。在更新的同时,我还将 wijmo 从 wijmo/wijmo 更新为 @grapecity/wijmo 包,因为它支持 IVY。

但在完成升级后,我可以编译应用程序,但在运行时出现以下错误

global-error-handler.service.ts:43 Error: Uncaught (in promise): TypeError: (0 , t[n]) is not a function
TypeError: (0 , t[n]) is not a function
    at backend.js:61
    at Reflect.<anonymous> (backend.js:61)
    at push../node_modules/@grapecity/wijmo.angular2.grid.detail/__ivy_ngcc__/index.js.__decorate (index.js:28)
    at index.js:53
    at Object../node_modules/@grapecity/wijmo.angular2.grid.detail/__ivy_ngcc__/index.js (index.js:53)
    at __webpack_require__ (bootstrap:84)

【问题讨论】:

  • 您能准确发布您使用的是哪个版本的 wijmo 吗?
  • 我使用的是“5.20202.732”版本。如果我在 tsconfig 中更改 "enableIvy": false 那么它工作正常。但如果我选择 IVY,我会收到上述错误。
  • 感谢您的信息。我们正在做一些调查。但是,如果您有一个重现样本,它将帮助我们更快地进行调试。请随时通过电子邮件与我们联系(见下文)。
  • 还有一个问题,你是在继承我们的组件吗?使用 Ivy 的装饰器有一些重大变化,它可能就是其中之一。我在下面的答案中添加了更多解释。我链接的主题也更全面。

标签: angular9 wijmo angular-ivy angular-upgrade grapecity


【解决方案1】:

我想了解有关此错误的更多信息。快速检查的是属性初始化顺序。在 Ivy 中,属性被解释为在标记中指定的(以前 wijmo 控制它们的解释方式)。因此,您可以通过在其他属性之前设置某些属性来破坏组件。

例如,如果我在设置数据源之前尝试在组合框上设置 selectedIndex,则应用程序会在运行时中断,因为列表中还没有可供选择的项目。

更多信息在这里:https://www.grapecity.com/wijmo/docs/GettingStarted/Angular-Components#property-initialization-order-in-angular-9-ivy-and-higher

接下来要检查的是组件装饰器(如果您要继承我们的组件)。 Ivy 中的装饰器发生了一些重大变化。

例如,您可能需要将 {descendants: true} 添加到 ContentChildren 查询。

或者你可能需要在你的类中添加一个 @Injectable 装饰器。

您可以在此处阅读有关 Ivy 中的重大更改以及如何修复它们的更多信息:https://angular.io/guide/ivy-compatibility-examples

但请随时联系我们直接工作:wijmoexperts@grapecity.com

【讨论】:

    猜你喜欢
    • 2020-05-25
    • 2020-07-01
    • 2019-10-17
    • 1970-01-01
    • 1970-01-01
    • 2020-06-08
    • 2019-10-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多