带有 Angular 个应用程序的 Freshdesk 反馈小部件

Freshdesk feedback widget with Angular application

我尝试在 Angular(版本 8.2.7)应用程序上安装 Freshdesk feedback widget

我已经使用 Freshdesk 管理门户创建了小部件嵌入代码。

插件代码在这里:

<script>
    window.fwSettings={
    'widget_id': <MY PERSONAL ID>
    };
    !function(){if("function"!=typeof window.FreshworksWidget){var n=function(){n.q.push(arguments)};n.q=[],window.FreshworksWidget=n}}() 
</script>
<script type='text/javascript' src='https://widget.freshworks.com/widgets/47000002937.js' async defer></script>

我在 </body> 标签前插入此代码后。

并且此脚本损坏了我的 Angular 应用程序。

错误在这里:

main.ts:12 Error: Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.
Most likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)
    at Function.assertZonePatched (zone-evergreen.js:52) [<root>]
    at new NgZone (core.js:39456) [<root>]
    at getNgZone (core.js:40707) [<root>]
    at PlatformRef.bootstrapModuleFactory (core.js:40522) [<root>]
    at vendor.js:83613:31 [<root>]
    at widget.freshworks.com/widgetBase/bootstrap.js:1:20208 [<root>]

如何解决这个错误?

感谢您的帮助。

您可以使用 Freshdesk Angular 包装器。

它作为 ngx-freshdesk-webwidget NPM 包提供。

源代码、文档和示例可用here