I am trying to use ASP.NET MVC (not the kernel) with AngularJS 2 and some routing problems.
First in RouteConfig.cs, I defined the following routes
routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } );
In my app.route.ts (angular routes), I just defined a couple of routes. My route is redirected to another route by default, for example
export const router: Routes = [{ path: '', redirectTo: 'auctions/e231', pathMatch: 'full' }, { path: 'auctions/:id', component: AuctionComponent, children: [] } ];
When I launch the application, my server route / Home / Index is served fine which loads the angular application and the default route in my app.route.ts redirects me to / e 231 auctions and my final browser url becomes
http:
Everything works as expected, but when I refresh the page with this URL, I get a server error for a resource that was not found, which is also expected because it is looking for a controller named Auctions that is not in MVC. I want to know why my spa spy route in RouteConfig.cs does not rise? There is also a better way to handle this script in asp.net mvc because I want to use some of my MVC controller actions like / Account / Login and others.
source share