我正在尝试在angularJS中实现Firechat,并遇到了一个奇怪的问题。
聊天初始化后,角度路线变为Firechat房间名称。
例如我最初在http://localhost/app/#/stream 当firechat加载路由变为 http://localhost/app/#/-KBLofTk2mb6AJCTSc5C
我似乎无法弄清楚firechat如何或为何改变路线。任何建议都会很棒:)
以下是我用来运行fireChat的代码:
$scope.goFireChat = function() {
var chatRef = new Firebase('https://blazing-fire-3021.firebaseio.com'),
target = document.getElementById("firechat-wrapper"),
chat = new FirechatUI(chatRef, target);
chatRef.onAuth(function(authData) {
if (authData) {
var userId = authData.uid,
userName = "Anonymous" + userId.substr(10, 8);
chat.setUser(userId, userName);
$timeout(function() {
chat._chat.enterRoom('-KBLofTk2mb6AJCTSc5C');
}, 2000);
} else {
$timeout(function() {
chat._chat.enterRoom('-KBLofTk2mb6AJCTSc5C');
}, 2000);
}
});
}