Angular routing is not working properly
<p>I am building a login page where a user has 2 roles i.e. student or librarian.
When the user enters his credentials and click on submit,the validate function will be called.</p>

<p>Now,</p>

<p>The problem I am facing is :</p>

<p>The routing is not working i.e. the control reaches to the alert("login successful"); and enters into if ($scope.roles[i].role === "student") {
 but does not direct the page to $location.path('/home/student');</p>

<p>The login page url is as below :</p>

<p><a href="http://localhost:63342/LabguideExamples/Assignment/Day4/Login.html?_ijt=oa5emr702cenehrs4oosarmg0d" rel="nofollow">http://localhost:63342/LabguideExamples/Assignment/Day4/Login.html?_ijt=oa5emr702cenehrs4oosarmg0d</a></p>

<p>The url after successful login is as below.</p>

<p><a href="http://localhost:63342/LabguideExamples/Assignment/Day4/Login.html?_ijt=oa5emr702cenehrs4oosarmg0d#/home/student" rel="nofollow">http://localhost:63342/LabguideExamples/Assignment/Day4/Login.html?_ijt=oa5emr702cenehrs4oosarmg0d#/home/student</a></p>

<p>The url still has Login.html and it is not replaced by 'ViewBooks_Student.html',as per app.js.</p>

<p>Any help is much appreciated.</p>

<p>Thanks</p>

<p>controller.js</p>

<pre><code>var Controllers = angular.module('Controllers', ['ngRoute']);
Controllers.controller('LoginCtrl', ['$scope','$http','$location',
function ($scope,$http,$location) {
    $scope.validate=function()
    {
        $http.get('data/roles.json').success(function(data) {
            $scope.roles = data;

        var count=0;
            for (var i = 0, len = $scope.roles.length; i &lt; len; i++) {
if ($scope.username === $scope.roles[i].username &amp;&amp; $scope.password === $scope.roles[i].password) {
                    alert("login successful");
                    count = count + 1;
                    if ($scope.roles[i].role === "student") {
                        $location.path('/home/student');
                        break;
                    }
                    else {
                        $location.path('/home/librarian');
                        break;
                    }

                }
            }

        if(count!=1)
        {
            alert("Please provide valid login credentials");
            $location.path( "/main" )
        }
        });
    }

}]);
</code></pre>

<p>app.js</p>

<pre><code>var bookApp = angular.module('bookApp',[
'Controllers','ngRoute'
]);
bookApp.config(['$routeProvider',
function($routeProvider) {
    $routeProvider.
    when('/main', {
        templateUrl: 'Login',
        controller: 'LoginCtrl'
    }).
    when('/home/student', {
        templateUrl: 'ViewBooks_Student.html',
        controller: 'BookListCtrl_Student'
    }).
    when('/home/librarian', {
        templateUrl: 'ViewBooks_Librarian.html',
        controller: 'BookListCtrl_Librarian'
    }).
    when('/issue/:bookId', {
        templateUrl: 'IssueBook.html',
        controller: 'IssueBookCtrl'
    }).
    when('/return/:bookId', {
        templateUrl: 'ReturnBook.html',
        controller: 'ReturnBookCtrl'
    }).
    otherwise({
        redirectTo: '/main'
    });
}]);
</code></pre>