Three simple steps to enable Angular HTML5 routes in ASP.NET MVC application.

  1. Redirect all controller actions to Index action, let angular handle view loading.
        name: "Default",
        url: "{controller}/{*parameters}",
        defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
  2. Add base element in head section:
    <base href="/">
  3. Enable html5 routes in angular module config function:


Source code

Check out my other projects
Active forks newsletter
Get a glimpse on open source active forks. Weekly newsletter with selection of repositories and their active forks.


Comments are closed