我有这个app.component.html,可以很好地工作于所有页面,除了登录(我不想要导航,侧边栏或页脚)
<app-nav></app-nav>
<app-sidebar></app-sidebar>
<div class="container">
<router-outlet></router-outlet>
</div>
<app-footer></app-footer>module.ts
const appRoutes:Routes = [
{path: '', redirectTo: '/login', pathMatch: 'full'},
{path: 'login', component:LoginComponent},
{path: 'dashboard', component:EnvironmentComponent},
{path: 'docker', component:DockerComponent}
];如何删除它??
发布于 2018-05-17 20:40:42
您需要根据您当前所在的url使用*ngIf来处理此问题。
<app-sidebar *ngIf="isLoginPage()"></app-sidebar>然后,
isLoginPage(): boolean {
const check = this.router.url.indexOf('/login');
if (check) {
return false;
}
return true;
}https://stackoverflow.com/questions/50391082
复制相似问题