0
我已经在ASP.NET MVC 4项目中实现了Angular2。 MVC路由重写了Angular 2路由。我怎样才能一起处理两个路由?Angular 2和ASP.NET MVC 4路由不能一起工作
我已经做以下修改:
_layout.cshtml:
<base href="/"/>
app.routing.ts:
const route: Routes= [
{path: 'firstpage', component: firstComponent},
{path: 'secondpage', component: secondComponent}
]
我已经添加以下代码以上MVC RouteConfig.cs中的默认路由:
routes.MapRoute(
name: "app1",
url: "app1/{*url}",
defaults: new { controller = "app1", action = "Index" }
);
我一直在使用下面的URL尝试:
http://localhost:50450/app1/firstpage
http://localhost:50450/#/app1/firstpage
仍不能正常工作,我该怎么办还是我错过了什么?