【问题标题】:core.js:9110 ERROR TypeError: $(...).flowchart is not a functioncore.js:9110 ERROR TypeError: $(...).flowchart is not a function
【发布时间】:2019-11-24 15:31:40
【问题描述】:

我正在开发一个 Angular 8 项目。在那个项目中,我试图将 flowchart jQuery 库嵌入到我的应用程序中。

但是当我使用 ng serve 运行我的项目时,它会成功构建,但在浏览器开发者控制台中我看到这些错误:

zone-evergreen.js:172 Uncaught TypeError: $.widget is not a function
    at HTMLDocument.<anonymous> (jquery.flowchart.js:4)
    at e (jquery.min.js:2)
    at t (jquery.min.js:2)
    at ZoneDelegate.invokeTask (zone-evergreen.js:391)
    at Zone.runTask (zone-evergreen.js:168)
    at invokeTask (zone-evergreen.js:465)
    at ZoneTask.invoke (zone-evergreen.js:454)
    at timer (zone-evergreen.js:2650)
client:52 [WDS] Live Reloading enabled.
core.js:9110 ERROR TypeError: $(...).flowchart is not a function
    at flow.component.ts:80
    at ZoneDelegate.invokeTask (zone-evergreen.js:391)
    at Object.onInvokeTask (core.js:34182)
    at ZoneDelegate.invokeTask (zone-evergreen.js:390)
    at Zone.runTask (zone-evergreen.js:168)
    at invokeTask (zone-evergreen.js:465)
    at ZoneTask.invoke (zone-evergreen.js:454)
    at timer (zone-evergreen.js:2650)

我搜索了它们并尝试安装相关模块并在我的项目的angular.json 文件中添加以下行:

    "scripts": [
     "./node_modules/jquery/dist/jquery.min.js",
     "./node_modules/jquery.panzoom/dist/jquery.panzoom.min.js",
     "./node_modules/jquery.flowchart/jquery.flowchart.js"

    ]

但似乎它不起作用,我仍然有上述错误。我可以通过这种方式解决与panzoom 相同的错误,但它不适用于widgetflowchart

【问题讨论】:

    标签: jquery angular flowchart


    【解决方案1】:

    我认为您缺少一个 js 文件。我在我的 Angular 项目中遇到了同样的问题,所以在我的项目中我添加了以下 js 文件。

    jquery-ui.min.js jquery.panzoom.min.js jquery.mousewheel.min.js jquery.flowchart.min.js

    希望对你有所帮助。

    【讨论】:

      猜你喜欢
      • 2018-05-09
      • 2017-08-01
      • 1970-01-01
      • 2015-04-20
      • 2018-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-17
      相关资源
      最近更新 更多