Angular 在应用程序组件后面创建登录组件

Angular 在应用程序组件后面创建登录组件,angular,routes,Angular,Routes,我有一个有角度的网站,有几个不同的组件路线 我在app.component.html上定义,路由区域大约占屏幕的70%,其他30%为静态菜单和徽标,这些菜单和徽标显示在每个屏幕/组件中 现在的问题是:我想在主应用程序后面创建一个登录屏幕(没有菜单、徽标等)。如果我去的话,菜单不会消失——这并不奇怪 我在app.module.ts const routes: Routes = [ { path: 'inicio', component: InicioComponent }, { path:

我有一个有角度的网站,有几个不同的组件路线

我在app.component.html上定义,路由区域大约占屏幕的70%,其他30%为静态菜单和徽标,这些菜单和徽标显示在每个屏幕/组件中

现在的问题是:我想在主应用程序后面创建一个登录屏幕(没有菜单、徽标等)。如果我去的话,菜单不会消失——这并不奇怪

我在
app.module.ts

const routes: Routes = [
  { path: 'inicio', component: InicioComponent },
  { path: 'list-my-aval', component: ListMyAvalComponent},
  { path: 'create-my-aval', component: CreateMyAvalComponent},
  { path: 'new-calendario', component: NewCalendarioComponent},
  { path: 'login', component: LoginComponent},
  { path: '', redirectTo: '/login', pathMatch: 'full'},

];
为了解决这个问题,你建议我做什么?
Ps:I m a begginer

如果您同意将所有登录组件放在更深的路径中,如:
/secure/inicio
/secure/list my aval
,并将登录组件放在最上面的路径中,那么您可以简单地使用子路由器,如下所示:

const routes: Routes = [
    {
        path: 'secure',
        component: SecureComponent,
        children: [
            { path: 'inicio', component: InicioComponent },
            { path: 'list-my-aval', component: ListMyAvalComponent },
            { path: 'create-my-aval', component: CreateMyAvalComponent },
            { path: 'new-calendario', component: NewCalendarioComponent },
        ]
    },
    { path: 'login', component: LoginComponent},
    { path: '', redirectTo: '/login', pathMatch: 'full' },
];

如果您同意将所有登录组件放在更深的路径中,如:
/secure/inicio
/secure/list my aval
,并将登录组件放在顶部路径中,如:
/login
,那么您可以简单地使用子路由器,如下所示:

const routes: Routes = [
    {
        path: 'secure',
        component: SecureComponent,
        children: [
            { path: 'inicio', component: InicioComponent },
            { path: 'list-my-aval', component: ListMyAvalComponent },
            { path: 'create-my-aval', component: CreateMyAvalComponent },
            { path: 'new-calendario', component: NewCalendarioComponent },
        ]
    },
    { path: 'login', component: LoginComponent},
    { path: '', redirectTo: '/login', pathMatch: 'full' },
];

请分享你的routing.module文件更新,我有这个变量你可以实现保护和有条件地隐藏导航栏,检查a和a工作,希望这是有用的!你可以将app.component.html添加到你的问题中。请共享你的routing.module文件更新,我得到了这个变量。你可以实施保护并有条件地隐藏导航栏,检查a和a是否正常工作,希望这对你有帮助!您可以将app.component.html添加到问题中