gpt4 book ai didi

Angular 2 和 Intercom.io

转载 作者:行者123 更新时间:2023-12-04 13:43:36 24 4
gpt4 key购买 nike

我想在我的 Angular 2 应用程序中使用对讲机。

对讲SPA说明是here

我已将脚本 block 放在 index.html 页面的头部,我的下一个想法是将以下内容放在我的应用程序组件中

ngOnInit()
{
window.Intercom("boot", {
app_id: "abcd",
name: "Jane Doe", // Full name
email: "customer@example.com", // Email address
created_at: 1312182000 // Signup date as a Unix timestamp
});

但是,它不会编译说 [ts]

Property 'Intercom' does not exist on type 'Window'.

如何使用 Angular2 和 webpack 让它工作并进一步进行?

最佳答案

我找到了将对讲机与 angular 2 集成的答案

更新 angular 2 的对讲指令而不是这个:

 window.Intercom("boot", {
app_id: "abcd",
name: "Jane Doe",
email: "customer@example.com",
created_at: 1312182000
});

使用它使其工作:

(<any>window).Intercom("boot", {
app_id: "abcd",
name: "Jane Doe",
email: "customer@example.com",
created_at: 1312182000
});

关于Angular 2 和 Intercom.io,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38342252/

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