firechat
firechat copied to clipboard
Firechat changes route in angularJS
Hey Guys,
I'm trying to implement Firechat in angularJS and have come across a weird issue.
After the chat initialises the angular route changes to the Firechat room name.
e.g I am initially on http://localhost/app/#/stream and when firechat loads the route changes to http://localhost/app/#/-KBLofTk2mb6AJCTSc5C
I can't seem to figure out how or why firechat is changing the route. Any advice would be great :)
Here is the code I am using to run 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);
}
});
}
I have encountered the same behavior. Did you find a solution?