I am customizing the ngx-admin template, I was trying to add new module in app module. And added its route in app-routing.module.ts. But its not working when i tried it open. It got stuck at loading. There is no error in console too. So I'm not understanding what might be the problem.
I have added this SignModule outside pages, not inside pages
app-routing.module.ts
import { ExtraOptions, RouterModule, Routes } from "@angular/router";
import { NgModule } from "@angular/core";
import {
NbAuthComponent,
NbLoginComponent,
NbRegisterComponent,
NbLogoutComponent,
NbRequestPasswordComponent,
NbResetPasswordComponent,
} from "@nebular/auth";
const routes: Routes = [
{
path: "pages",
loadChildren: () =>
import("../app/pages/pages.module").then(m => m.PagesModule),
},
//Newly added Module
{
path: "sign",
loadChildren: () =>
import("../app/sign/sign.module").then(m => m.SignModule),
},
{
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: "sign", pathMatch: "full" },
{ path: "**", redirectTo: "pages" },
];
const config: ExtraOptions = {
useHash: false,
enableTracing: true,
};
@NgModule({
imports: [RouterModule.forRoot(routes, config)],
exports: [RouterModule],
})
export class AppRoutingModule {}
This is the new module I added. SignModule
sign.module.ts file
import { NgModule } from '@angular/core';
import { ThemeModule } from '../@theme/theme.module';
import { SignComponent } from './sign.component';
import { SigninModule } from './signin/signin.module';
import { SignupModule } from './signup/signup.module';
import { SignRoutingModule } from './sign-routing.module';
@NgModule({
imports: [
SignRoutingModule,
ThemeModule,
SigninModule,
SignupModule,
],
declarations: [SignComponent],
})
export class SignModule { }
sign-routing.module.ts
import { NgModule, } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { SigninComponent } from './signin/signin.component';
import { SignupComponent } from './signup/signup.component';
import { SignComponent } from './sign.component';
const routes: Routes = [
{
path: '',
component: SignComponent,
children: [
{
path: 'signin',
component: SigninComponent
},
{
path: 'signup',
component: SignupComponent
},
{
path: '',
redirectTo: 'signin',
pathMatch: 'full',
}
]
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class SignRoutingModule { }
It's because of the nebular theme used by ngx-admin. Only those pages/components are displayed which are wrapped in nb-layout
The spinner for pages which are wrapped under nb-layout
. Hence it skips displaying the pages/components you added.
And the correct way of doing it is
<nb-layout>
<nb-layout-column>
// Your content
</nb-layout-column>
</nb-layout>