typescript - 如何在 ngx-admin 模板中使组件全屏显示?
问题描述
我一直在尝试使我的新登录页面组件在 ngx-admin 模板中全屏显示。每当我尝试显示登录组件时,它都会进入带有侧面导航的模板。我在 pages 模块中创建了这个登录组件。请帮我把它转换成全屏。
import { ExtraOptions, RouterModule, Routes } from '@angular/router';
import { NgModule } from '@angular/core';
import {
NbAuthComponent,
NbLoginComponent,
NbLogoutComponent,
NbRegisterComponent,
NbRequestPasswordComponent,
NbResetPasswordComponent,
} from '@nebular/auth';
import { LoginComponent } from './login/login.component';
const routes: Routes = [
{path : '' , component: LoginComponent},
{ path: 'pages', loadChildren: 'app/pages/pages.module#PagesModule' },
{
path: 'auth',
component: NbAuthComponent,
children: [
{
path: '',
component: NbLoginComponent,
},
{
path: 'login',
component: NbLoginComponent,
},
{
path: 'register',
component: NbRegisterComponent,
},
{
path: 'logout',
component: NbLogoutComponent,
},
{
path: 'request-password',
component: NbRequestPasswordComponent,
},
{
path: 'reset-password',
component: NbResetPasswordComponent,
},
],
},
{ path: '', redirectTo: 'login', pathMatch: 'full' },
{ path: '**', redirectTo: 'pages' },
];
const config: ExtraOptions = {
useHash: true,
};
@NgModule({
imports: [RouterModule.forRoot(routes, config)],
exports: [RouterModule],
})
export class AppRoutingModule {
}
解决方案
要更改登录组件,您需要将NbLoginComponent
routes 数组中的条目替换为您的自定义LoginComponent
.
还要从路由数组中删除{path : '' , component: LoginComponent},
和。{ path: '', redirectTo: 'login', pathMatch: 'full' },
如果您还需要修改 auth 组件的通用包装器(带有后退按钮的卡片),您可以修改NbAuthComponent
模板。
有关分步说明,请参阅自定义身份验证组件指南。
推荐阅读
- ios - 使用表单时视图之间出现随机白线
- java - 将方法(java)中的值作为参数传递
- typescript - Typescript 编译器允许将 JSON 对象分配给类型化的类变量
- azure - 如何在运行时重命名 Databricks 作业集群名称
- java - 我可以设置 JVM 崩溃小型转储的输出位置吗?
- python - 沿特定维度洗牌张量
- python - Python中的连续图像遮罩
- spring-boot - KeyCloak Spring Boot - 在验证成功时添加自定义代码
- oracle - Oracle DBMS_Scheduler 每天上午 9:10 和 11:30 运行 DBMS_JOB
- jquery - 向每个 javascript 页面添加代码的快捷方式(使用可变 jquery 选择器)