- 我正在尝试在我的代码库中包含 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"
}
});
- 在这里提供完整的代码,因为我的代码库很大
最佳答案
在您的应用模块中:
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/