I'm making a signup page that has its own components for each page.
I had seen in a tutorial that you can use: ...SignUpRoutes
between the paths in the app-routing.module
For example, currently I have within sign-up-routing.module;
export const SignUpRoutes: Routes = [
{
path: 'sign-up',
component: SignUpComponent,
children: [
{ path: 'me', component: MeComponent },
{ path: 'contact', component: ContactComponent },
{ path: 'payment', component: PaymentComponent }
]
}
];
@NgModule({
imports: [RouterModule.forChild(SignUpRoutes)],
exports: [RouterModule]
})
export class SignUpRoutingModule {}
Then in app-routing-module:
const routes: Routes = [
{
path: '', component: HomeComponent
},
{
path: 'sign-up', component: SignUpComponent
},
...SignUpRoutes,
{
path: 'login', component: LoginComponent
},
{
path: '**', redirectTo: ''
}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
I tried following the Angular Routing guide, however all pages are coming up as blank.
if I manually navigate to /sign-up/contact
the routing wildcard in app-routing.module redirects to home but as blank. If I try to navigate to /sign-up/me
then the page sort of loads, but is blank, and forms are on page but not visible.
Within the sign-up.component html template, there is a <router-outlet>
.
Am unsure how to proceed as it feels like i've hit a brick wall... Any help is much appreciated :)