app / app.component.ts(192,17):错误TS2339:属性' init'类型'对讲'
上不存在包 https://www.npmjs.com/package/ng-intercom
ngOnInit(): void {
this.intercom.init({
app_id: "mobilecode",
// Supports all optional configuration.
widget: {
"activator": "#intercom"
}
});
答案 0 :(得分:1)
在您的app-module中:
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`
})
...
]
})
答案 1 :(得分:1)
我通过使用update()而不是init()来实现它(在1.0.0-beta.11中)。我所做的是更改ngOnInit()
中的行来自
this.intercom.init({
到
this.intercom.update({
整个区块将如下所示:
ngOnInit() {
this.intercom.update({
app_id: <app_id>,
// Supports all optional configuration.
widget: {
"activator": "#intercom"
}
});
}
希望这有帮助!
(另一个quickfix正在降级到1.0.0-beta.10,其中init()确实有效。)