【发布时间】:2018-01-18 23:08:38
【问题描述】:
我已经让网络聊天在 Chrome 中正常工作,但在 IE 中却没有。 我的应用是一个使用 WebChat 连接到我的机器人的 Angular 网站。
代码看起来像这样(技术上这是 TypeScript,而不是 JavaScript,箭头函数被转译出来):
directLine: DirectLine = new DirectLine({ secret: environment.botDirectLineSecretKey })
@ViewChild("botWindow") botWindowElement: ElementRef;
ngOnInit() {
this.directLine.activity$
.filter(activity => activity.type === "event" && activity.name === "init")
.subscribe(activity => this.changeSize());
BotChat.App({
botConnection: this.directLine,
user: { id: 'user' },
bot: { id: 'bot' },
}, this.botWindowElement.nativeElement);
}
changeSize(){
console.log("here")
var container = document.getElementById("bot-chat-container");
container.classList.add("fullSize");
}
在 Internet Explorer 中,我在控制台中收到此错误:
错误类型错误:您提供了一个无效的对象,其中流是 预期的。您可以提供 Observable、Promise、Array 或 Iterable。
如果我将botConnection: this.directLine 切换到directLine: this.directLine,网络聊天可以工作,但 changeSize() 方法永远不会被调用。
感谢任何帮助。此机器人正在公共网站上运行,必须支持 IE。
【问题讨论】:
-
这是在黑暗中拍摄的,但你在
.filter之前尝试过.subscribe -
谢谢,但没有。我明白了。 “订阅”类型上不存在属性“过滤器”。但值得一试。
标签: javascript internet-explorer botframework direct-line-botframework