Simplify routing configuration.

This commit is contained in:
Alexis Lahouze 2018-06-13 22:09:10 +02:00
parent f36a0bfa92
commit bbac3e67bc
2 changed files with 11 additions and 17 deletions

View File

@ -24,20 +24,16 @@ import { OperationEditComponent } from './operationEdit.component';
import { OperationDeleteModalComponent } from './operationDeleteModal.component'; import { OperationDeleteModalComponent } from './operationDeleteModal.component';
import { OperationFormComponent } from './operationForm.component'; import { OperationFormComponent } from './operationForm.component';
import { OperationEditModalComponent } from './operationEditModal.component'; import { OperationEditModalComponent } from './operationEditModal.component';
import { OperationListState } from './operation.states'; import { OperationRoutes } from './operation.states';
import { OperationNewState } from './operation.states';
import { OperationEditState } from './operation.states';
@NgModule({ @NgModule({
imports: [ imports: [
HttpClientModule, HttpClientModule,
CommonModule, CommonModule,
ReactiveFormsModule, ReactiveFormsModule,
RouterModule.forChild([ RouterModule.forChild(
OperationListState, OperationRoutes
OperationNewState, ),
OperationEditState
]),
NgLoggerModule, NgLoggerModule,
ToastrModule, ToastrModule,
NgbModule, NgbModule,

View File

@ -1,21 +1,19 @@
// vim: set tw=80 ts=2 sw=2 sts=2 : // vim: set tw=80 ts=2 sw=2 sts=2 :
import { Routes } from '@angular/router';
import { OperationListComponent } from './operationList.component'; import { OperationListComponent } from './operationList.component';
import { OperationNewComponent } from './operationNew.component'; import { OperationNewComponent } from './operationNew.component';
import { OperationEditComponent } from './operationEdit.component'; import { OperationEditComponent } from './operationEdit.component';
export const OperationListState = { export const OperationRoutes: Routes = [{
path: 'account/:accountId/operations', path: 'account/:accountId/operations',
component: OperationListComponent, component: OperationListComponent,
onSameUrlNavigation: 'reload' //onSameUrlNavigation: 'reload'
}; }, {
export const OperationNewState = {
path: 'account/:accountId/operations/new', path: 'account/:accountId/operations/new',
component: OperationNewComponent, component: OperationNewComponent,
}; }, {
export const OperationEditState = {
path: 'account/:accountId/operations/:operationId/edit', path: 'account/:accountId/operations/:operationId/edit',
component: OperationEditComponent, component: OperationEditComponent,
}; }];