Created
August 5, 2019 12:01
-
-
Save nathan-lapinski/29dbeb3da2a54f5b9ba43c392cb4a61e to your computer and use it in GitHub Desktop.
Very basic routing setup
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 { BrowserModule } from '@angular/platform-browser'; | |
import { RouterModule } from '@angular/router'; | |
import { Component, Input } from '@angular/core'; | |
import { AppComponent } from './app.component'; | |
@Component({ | |
template: `<h1>This is Component A</h1>` | |
}) | |
export class ComponentA { | |
} | |
@Component({ | |
template: `<h1>This is Component B</h1>` | |
}) | |
export class ComponentB { | |
} | |
const ROUTES = [ | |
{ path: 'a', component: ComponentA }, | |
{ path: 'b', component: ComponentB }, | |
]; | |
@NgModule({ | |
imports: [ BrowserModule, RouterModule.forRoot(ROUTES) ], | |
declarations: [ AppComponent, ComponentA, ComponentB ], | |
bootstrap: [ AppComponent ] | |
}) | |
export class AppModule { } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment