Angular5不带/home url的登录页
我希望我的登录页URL为myapp.com 目前,在src/index.html中Angular5不带/home url的登录页,angular,Angular,我希望我的登录页URL为myapp.com 目前,在src/index.html中 <head> <base href="/"> </head> <router-outlet></router-outlet> 我不想将myapp.com重定向到myapp.com/home,我想让myapp.com显示我的登录页,我想让myapp.com/feature显示另一页。如果你不想让myapp.com重定向到nyapp.com/home
<head>
<base href="/">
</head>
<router-outlet></router-outlet>
我不想将myapp.com重定向到myapp.com/home,我想让myapp.com显示我的登录页,我想让myapp.com/feature显示另一页。如果你不想让myapp.com重定向到nyapp.com/home,你为什么要让它这样做 摆脱这一行:
{path: '', redirectTo: '/home', pathMatch: 'full'}
因此,您的路线如下所示:
const appRoutes: Routes = [
{path: '', component: HomeComponent},
{path: 'feature', component: FeatureComponent}
];
如果您不希望myapp.com重定向到nyapp.com/home,为什么要让它这样做 摆脱这一行:
{path: '', redirectTo: '/home', pathMatch: 'full'}
因此,您的路线如下所示:
const appRoutes: Routes = [
{path: '', component: HomeComponent},
{path: 'feature', component: FeatureComponent}
];
更改路由以使到组件的路由为:
{path:'',组件:HomeComponent,pathMatch:'full'}
并摆脱执行重定向的路由应该可以做到这一点。更改路由以使到组件的路由为:{path:'',组件:HomeComponent,pathMatch:'full'}
并且摆脱执行重定向的路由应该可以做到这一点。他需要:{path:,component:HomeComponent}哦,他希望HomeComponent成为他的登录页他需要:{path:,component:HomeComponent}哦,他希望HomeComponent成为他的登录页