title: How can i redirect to the page using angular js while i am using javascript window.location
body: <p>I am using <code>javaScript</code> onsubmit function to redirect to particular page based on role. I am also using <code>AngularJS</code> in my app.but when i press enter after filling form the page is directly going to that page instead of loading the page in <code>ng-view</code>. how can i solve this?</p>
  
  <p>code:</p>
  
  <pre><code>function next(){
      var role = location.search.substring(1);
      if ( role == "vp"){
          //alert ("Login successfully");
          window.location = "results.html?vp";//redirecting to other page
          //return false;
      }
      else{
          window.location = "results-locked.html?sales";
      }
  }
  </code></pre>
  
  <p>Angular JS</p>
  
  <pre><code>var module = angular.module("portalApp", ['ngRoute']);
  
   module.config(['$routeProvider',
          function($routeProvider) {
              $routeProvider.
                  when('/home', {
                      templateUrl: 'home.html',
                  }).
  
                  when('/results', {
                      templateUrl: 'results.html',
                  }).
  
                  when('/lock-results', {
                      templateUrl: 'results-locked.html',
                  }).
  
                  otherwise({
                      redirectTo: '/home'
                  });
          }]);
  </code></pre>
  
  <p>Html:</p>
  
  <pre><code>&lt;div class="search-form"&gt;
    &lt;form method="post" name="myform"  action="javascript:next()" class="ourform"&gt;
    &lt;img src="images/mic.png" class="mic"&gt;
    &lt;input type="search" id="search" name="search" placeholder="Type or speak here to search"&gt;
    &lt;input type="image" alt="submit" src="images/search.jpg" class="submit"/&gt;
    &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>instead i want some thing like <code>href="#/results"</code> and <code>href="#/results-locked"</code> in javascript.</p>