Skip to content

Instantly share code, notes, and snippets.

@nathan-lapinski
Created August 5, 2019 12:01
Show Gist options
  • Save nathan-lapinski/29dbeb3da2a54f5b9ba43c392cb4a61e to your computer and use it in GitHub Desktop.
Save nathan-lapinski/29dbeb3da2a54f5b9ba43c392cb4a61e to your computer and use it in GitHub Desktop.
Very basic routing setup
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