Skip to content

Instantly share code, notes, and snippets.

@alexzuza
Created March 20, 2018 06:17
Show Gist options
  • Save alexzuza/18113e09140175479e8858ad816d3479 to your computer and use it in GitHub Desktop.
Save alexzuza/18113e09140175479e8858ad816d3479 to your computer and use it in GitHub Desktop.
DI simple routed application
@Component({
selector: 'my-app',
template: `<router-outlet></router-outlet>`,
})
export class AppComponent {}
...
@NgModule({
imports: [
BrowserModule,
RouterModule.forRoot([
{ path: 'child', component: ChildComponent },
{ path: '', redirectTo: '/child', pathMatch: 'full' }
])
],
declarations: [
AppComponent,
ChildComponent,
GrandChildComponent
],
bootstrap: [ AppComponent ]
})
export class AppModule { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment