I am trying to change the URL of the page if an $html callback is a success.
Module:
var app = angular.module('mymodule', ['ngRoute','ui.bootstrap']);
app.config(function($locationProvider, $routeProvider) {
$locationProvider.html5Mode(true);
$routeProvider.
when('/Home/Index', {
templateUrl: '/Home/Index',
controller: 'HomeController'
});
});
Controller:
$http({
method: 'POST',
url: '/User/InsertInitialUserInfo',
data: insertUserParams
}).success(function (data, status) {
$location.url("/Home/Index");
}).error(function (data, status) {
console.log(status);
});
MVC Controller
public ActionResult Index()
{
return View();
}
After my controller code runs the URL changes from : localhost:xxxx/Home/Register to localhost:xxxx/Home/Index
But the view doesn't change. What am I missing?
$location.path("/Home/Index")