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

标签 javascript html node.js angular intercom

  • 我正在尝试在我的代码库中包含 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/

相关文章:

javascript - 样式输入类型 ="file"- 文件名 javascript-solution 不起作用

javascript - 如何使用 JavaScript 从某些 html 标签中删除文本

javascript - Onchange 使用 ajax 提交没有表单 ID 的表单

javascript - 为什么 getPrototypeOf 'null' 会出错?

html - 设置除包含图像的 anchor 之外的所有 anchor 的样式,而不向图像标签添加 class 或 id?

javascript - 与 include 一起使用时,Sequelize 返回空值

javascript - 由于绑定(bind)安装,Dockerfile 和 docker-compose 找不到节点模块

html - 如何在保持宽高比的同时使任意 SVG 放大到其父容器?

javascript - 如何在解析中关闭 beforeSave afterSave Hook 的日志记录

javascript - Node |模块.js :540 throw err