From dd2c299e35c7e1b10137de9711e89fd7159e14e4 Mon Sep 17 00:00:00 2001 From: Billy Brawner Date: Mon, 27 Aug 2018 21:54:21 -0500 Subject: [PATCH] Add routing --- src/app/app-routing.module.spec.ts | 13 +++++++++++++ src/app/app-routing.module.ts | 19 +++++++++++++++++++ src/app/app.component.html | 2 +- src/app/app.module.ts | 4 +++- 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 src/app/app-routing.module.spec.ts create mode 100644 src/app/app-routing.module.ts diff --git a/src/app/app-routing.module.spec.ts b/src/app/app-routing.module.spec.ts new file mode 100644 index 0000000..d68ef06 --- /dev/null +++ b/src/app/app-routing.module.spec.ts @@ -0,0 +1,13 @@ +import { AppRoutingModule } from './app-routing.module'; + +describe('AppRoutingModule', () => { + let appRoutingModule: AppRoutingModule; + + beforeEach(() => { + appRoutingModule = new AppRoutingModule(); + }); + + it('should create an instance', () => { + expect(appRoutingModule).toBeTruthy(); + }); +}); diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts new file mode 100644 index 0000000..89aac3c --- /dev/null +++ b/src/app/app-routing.module.ts @@ -0,0 +1,19 @@ +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; +import { TransactionsComponent } from './transactions/transactions.component'; + +const routes: Routes = [ + { path: '', redirectTo: '/transactions', pathMatch: 'full' }, + { path: 'transactions', component: TransactionsComponent }, +] + +@NgModule({ + imports: [ + RouterModule.forRoot(routes) + ], + exports: [ + RouterModule + ], + declarations: [] +}) +export class AppRoutingModule { } diff --git a/src/app/app.component.html b/src/app/app.component.html index 97be44d..0680b43 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1 +1 @@ - + diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 6c59419..6d7c4ac 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -5,6 +5,7 @@ import {MatButtonModule, MatIconModule, MatListModule, MatToolbarModule} from '@ import { AppComponent } from './app.component'; import { TransactionsComponent } from './transactions/transactions.component'; +import { AppRoutingModule } from './app-routing.module'; @NgModule({ declarations: [ @@ -17,7 +18,8 @@ import { TransactionsComponent } from './transactions/transactions.component'; MatButtonModule, MatIconModule, MatListModule, - MatToolbarModule + MatToolbarModule, + AppRoutingModule ], providers: [], bootstrap: [AppComponent]