title: navigation from one page to another in angularjs
body: <p>I know i have already asked the same question but i am getting nowhere with this problem..I am trying to navigate from login page to next page...</p>
  
  <p>login.html</p>
  
  <pre><code>&lt;body&gt;
  &lt;div id='content' ng-app='myApp' ng-controller='LoginController'&gt;
  &lt;div class="container"&gt;
  &lt;form class="form-signin" role="form" ng-submit="login()"&gt;
     &lt;h3 class="form-signin-heading"&gt;Login Form&lt;/h3&gt;
     &lt;span&gt;&lt;b&gt;Username :&lt;/b&gt;&amp;nbsp;
      &lt;input type="username" class="form-control" ng-model="user.name"  required&gt;
     &lt;/span&gt;
     &lt;/br&gt;&lt;/br&gt;
     &lt;span&gt;&lt;b&gt;Password :&lt;/b&gt;&amp;nbsp;&amp;nbsp;
       &lt;input type="password" class="form-control" ng-model="user.password" required&gt;
     &lt;/span&gt;
     &lt;label class="checkbox"&gt;
      &lt;input type="checkbox" value="remember-me"&gt; Remember me
      &lt;/label&gt;
     &lt;button class="btn btn-lg btn-primary btn-block"  type="submit" &gt;           
     &lt;b&gt;Sign in&lt;/b&gt;&lt;/button&gt;       
    &lt;/form&gt;
    &lt;/div&gt; &lt;!-- /container --&gt;
    &lt;/div&gt;   
   &lt;/body&gt;
  </code></pre>
  
  <p>my app file is</p>
  
  <pre><code>'use strict';
  //Define Routing for app
  
  var applog = angular.module('myApp',['ngRoute']);
  applog.config(['$routeProvider', '$locationProvider',
  function($routeProvider,$locationProvider) {
   $routeProvider
    .when('/login', {
       templateUrl: 'html/navAng.html',
       controller: 'LoginController'
     })    
    .otherwise({
      redirectTo: 'html/navAng.html'
     });
     $locationProvider.html5Mode(true); //Remove the '#' from URL.
    }]);
  </code></pre>
  
  <p>and the controller is</p>
  
  <pre><code> applog.controller("LoginController", function($scope, $location){     
  
  
  $scope.login=function()
     {
  
      var username=$scope.user.name;
      var password=$scope.user.password;
      if(username=="admin" &amp;&amp; password=="admin")
      {
  
          $location.path( "html/navAng.html" );
      }
      else
      {
          $scope.message="Error";
          $scope.messagecolor="alert alert-danger";
      }
    }
  
  });
  </code></pre>
  
  <p>now when i click on the login button the url is getting generated but it just changes the url in the url tab and nothing happens i.e the page is not getting refreshed or navigating to the next page....can someone help plz...</p>