I'm currently working on an app made with AngularJS using Firebase logging system. I have a strange redirect when I try to login - it redirects to the register page for some reason no matter if the logging is successful or not. If the alert shoud show up it shows up at the register page.
Tried deleting the route to register page - no luck. Tried deleting actions that happened when OnAuthStateChanged triggered - still redirects. Tried debugging the app - it seems that the function

```
for (var i = 0; i < eventFnsLength; i++) {
  if (!event.isImmediatePropagationStopped()) {
    handlerWrapper(element, event, eventFns[i]);
  }
}

```

in angular.js in line 3532 causes that but I have no idea how to make it stop.

SignInCtrl.js

```
angular.module('szybkiePisanie')
.controller('SignInCtrl', ["$scope", "$firebaseAuth", function ($scope, $firebaseAuth) {
    $scope.SignIn = function (event) {
        if ($scope.user.email != undefined) var email = $scope.user.email; else { alert("Wpisz adres e-mail"); return; }
        if ($scope.user.password != undefined) var password = $scope.user.password; else { alert("Wpisz hasło"); return; }
        firebase.auth().signInWithEmailAndPassword(email, password).catch(function (error) {                
            var errorCode = error.code;
            var errorMessage = error.message;

            if (email.length < 4) {
                alert('Proszę wpisać adres email.');
                return;
            }
            if (password.length < 4) {
                alert('Proszę wpisać hasło.');
                return;
            }
            ;
            if (errorCode === 'auth/wrong-password') {
                alert('Błędne hasło.');
            }
            else if (errorCode === 'auth/invalid-email') {
                alert('Nieprawidłowy adres email');
            }
            else if (errorCode === 'auth/user-disabled') {
                alert('Użytkownik zablokowany');
            }
            else if (errorCode) {
                alert(errorMessage);
            }
        })
    }
}]);

```

RegisterCtrl.js

```
angular.module('szybkiePisanie')
.controller('RegisterCtrl', ["$scope", "$firebaseAuth", function ($scope, $firebaseAuth) {
    $scope.Register = function (event) {
        if ($scope.user.email != undefined) var email = $scope.user.email; else { alert("Wpisz mejl"); return; }
        if ($scope.user.password != undefined) var password = $scope.user.password; else { alert("Wpisz haslo"); return; }
        firebase.auth().createUserWithEmailAndPassword(email, password).catch(function (error) {
            var errorCode = error.code;
            var errorMessage = error.message;

            if (email.length < 4) {
                alert('Please enter an email address.');
                return;
            }
            if (password.length < 4) {
                alert('Please enter a password.');
                return;
            }
        })
    }
}]);

```

script.js(routing)

```
angular.module('szybkiePisanie', ['ngRoute', 'firebase'])
.config(['$routeProvider',
    function ($routeProvider) {
        $routeProvider
            .when('/home', {
                templateUrl: 'Home/home.html',
                controller: 'HomeCtrl'
            })

            .when('/practice', {
                templateUrl: 'Practice/practice.html',
                controller: 'PracticeCtrl'
            })

            .when('/signin', {
                templateUrl: 'SignIn/signin.html',
                controller: 'SignInCtrl'
            })

            .when('/profile', {
                templateUrl: 'Profile/profile.html',
                controller: 'ProfileCtrl'
            })

            .when('/register', {
                templateUrl: 'Register/register.html',
                controller: 'RegisterCtrl'
            })

            .otherwise({
                redirectTo: '/home'
            })
    }]);

```

Edit:
Redirect is not only caused by Singing in. In fact any button or dropdown will cause my app to redirect from '/singin' to '/register'. Strange.