I'm trying to remove # from angularjs default routing from an asp.net MVC project using html5
app.js
.config(function ($routeProvider, $locationProvider) {
$locationProvider.hashPrefix("!").html5Mode(true);
$routeProvider
.when('/', { templateUrl: '/home/index' })
.when('/domain', { templateUrl: '/domain/index' })
.otherwise({ redirectTo: '/' });
My landing point is /Home/Spa
.net MVC routing:
routes.MapLocalizedRoute("HomePage",
"",
new { controller = "Home", action = "Spa" },
new[] { "Nop.Web.Controllers" });
routes.MapLocalizedRoute("Default2",
"{*url}",
new { controller = "Home", action = "Spa" },
new[] { "Nop.Web.Controllers" });
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
new[] { "Nop.Web.Controllers" }
);
routes.MapRoute("ShoppingCart",
"cart/",
new { controller = "ShoppingCart", action = "Cart" },
new[] { "Nop.Web.Controllers" });
Everything works fine but sometimes i want to use Non Spa routing like ShoppingCart (/cart), it always redirect back to Home due to .otherwise({ redirectTo: '/' });.
How can i make some exception rule in this case ?