firechat icon indicating copy to clipboard operation
firechat copied to clipboard

Firechat changes route in angularJS

Open dyllen opened this issue 9 years ago • 1 comments

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);
                }
            });
        }

dyllen avatar Apr 18 '16 00:04 dyllen

I have encountered the same behavior. Did you find a solution?

d1b1 avatar Mar 18 '17 23:03 d1b1