gpt4 book ai didi

javascript - 应用程序/app.component.ts(192,17) : error TS2339: Property 'init' does not exist on type 'Intercom'

转载 作者:行者123 更新时间:2023-11-30 14:49:57 26 4
gpt4 key购买 nike

  • 我正在尝试在我的代码库中包含 intercom npm 包
  • 但我遇到了以下错误。
  • 你们能告诉我如何解决吗?
  • 在下面提供我的代码片段

app/app.component.ts(192,17):错误 TS2339:“Intercom”类型上不存在属性“init”。

https://www.npmjs.com/package/ng-intercom

ngOnInit(): void {

this.intercom.init({
app_id: "mobilecode",
// Supports all optional configuration.
widget: {
"activator": "#intercom"
}
});
  • 在这里提供完整的代码,因为我的代码库很大

https://hastebin.com/nafocafaze.js

最佳答案

在您的应用模块中:

import { IntercomModule } from 'ng-intercom';

@NgModule({
imports: [
...
IntercomModule.forRoot({
appId: <your_app_id>, // from your Intercom config
updateOnRouterChange: true // will automatically run `update` on router event changes. Default: `false`
})
...
]
})

关于javascript - 应用程序/app.component.ts(192,17) : error TS2339: Property 'init' does not exist on type 'Intercom' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48296578/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com