-
-
Save chgc/d4f25d65d779e4a2ba86b96fdcc4ae34 to your computer and use it in GitHub Desktop.
nest router-outlet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {NgModule} from '@angular/core'; | |
import {RouterModule, Routes} from '@angular/router'; | |
import {DashboardComponent} from './dashboard/dashboard.component'; | |
import {LayoutComponent} from './dashboard/layout/layout.component'; | |
import {HomeComponent} from './home/home.component'; | |
const routes: Routes = [ | |
{path: '', redirectTo: 'dashboard', pathMatch: 'full'}, { | |
path: 'dashboard', | |
component: LayoutComponent, | |
children: [ | |
{path: '', component: DashboardComponent}, | |
{path: 'home', component: HomeComponent} | |
] | |
} | |
]; | |
@NgModule({imports: [RouterModule.forRoot(routes)], exports: [RouterModule]}) | |
export class AppRoutingModule { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { BrowserModule } from '@angular/platform-browser'; | |
import { NgModule } from '@angular/core'; | |
import { AppRoutingModule } from './app-routing.module'; | |
import { AppComponent } from './app.component'; | |
import { DashboardComponent } from './dashboard/dashboard.component'; | |
import { HomeComponent } from './home/home.component'; | |
import { LayoutComponent } from './dashboard/layout/layout.component'; | |
@NgModule({ | |
declarations: [ | |
AppComponent, | |
DashboardComponent, | |
HomeComponent, | |
LayoutComponent | |
], | |
imports: [ | |
BrowserModule, | |
AppRoutingModule | |
], | |
providers: [], | |
bootstrap: [AppComponent] | |
}) | |
export class AppModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p> | |
layout works! | |
</p> | |
<router-outlet></router-outlet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment