title: AngularJS Post to controller and redirect to another page
body: <p>Is it possible to redirect to another View <code>SecondView()</code> after post request from angularjs. I know that angular have somethig like <code>$location.path</code>. But i want to check some conditions in controller.</p>
  
  <p>JavaScript</p>
  
  <pre><code>var MyApp = angular.module("MyApp", []);
  MyApp.controller("AppController", function ($scope,$http) {
      $scope.onClick = function () {
          $http({
              method: 'POST',
              url: 'Home/CheckData/',
              data: {name: 'Jhon'},
          });
      };
  });
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>public class HomeController : Controller
  {
      //
      // GET: /Home/
  
      public ActionResult Index()
      {
          return View();
      }
  
      [HttpPost]
      public ActionResult CheckData(string name)
      {
          if (name=="Jhon")
          {
          return RedirectToAction("SecondView");}
          else{
              return View();
          }
      }
  
      public ActionResult SecondView()
      {
          return View();
      }
  }
  </code></pre>
  
  <p>Index.cshtml</p>
  
  <pre><code>@{
      ViewBag.Title = "Index";
  }
  
  &lt;h2&gt;Index&lt;/h2&gt;
  &lt;script src="~/Scripts/angular.js"&gt;&lt;/script&gt;
  &lt;script src="~/Scripts/MyScript.js"&gt;&lt;/script&gt;
  
  &lt;div ng-app="MyApp" ng-controller="AppController"&gt;
      &lt;input ng-click="onClick()" type="button" value="Redirect" /&gt;
  &lt;/div&gt;
  </code></pre>