Created
March 20, 2018 06:17
-
-
Save alexzuza/18113e09140175479e8858ad816d3479 to your computer and use it in GitHub Desktop.
DI simple routed application
This file contains hidden or 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
@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