Skip to content

Commit c8aaea6

Browse files
committed
conf lazy load files module
1 parent 9576759 commit c8aaea6

16 files changed

+58
-67
lines changed

src/angular/src/app/admin/admin.component.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/angular/src/app/admin/admin.module.spec.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/angular/src/app/admin/admin.module.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/angular/src/app/app-routing/app-routing.module.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,23 @@ import { TodoEditComponent } from '../todo/todo-edit/todo-edit.component';
66

77
const routes: Routes = [
88
{
9-
path: '',
10-
redirectTo: 'todopage',
11-
pathMatch: 'full'
12-
},
13-
{
14-
path: 'adminpage',
15-
loadChildren: () => import('../admin/admin.module').then(m => m.AdminModule),
9+
path: 'files',
10+
loadChildren: () => import('../files/files.module').then(m => m.FilesModule)
1611
},
1712
{
1813
path: 'todopage',
1914
component: TodoComponent
2015
},
21-
{ path: 'todopage/:id', component: TodoEditComponent },
22-
{ path: '**', redirectTo: 'todopage' } // bad routes redirect to todopage
16+
{
17+
path: 'todopage/:id',
18+
component: TodoEditComponent
19+
},
20+
{
21+
path: '',
22+
redirectTo: 'todopage',
23+
pathMatch: 'full'
24+
},
25+
{ path: '**', redirectTo: 'todopage' }
2326
];
2427

2528
@NgModule({

src/angular/src/app/app.module.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { CompModule } from './comp/comp.module';
1313
import { ToastrModule } from 'ngx-toastr';
1414
import { TodoModule } from './todo/todo.module';
1515
import { AppRoutingModule } from './app-routing/app-routing.module';
16-
import { AdminModule } from './admin/admin.module';
1716
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
1817
import { CustomDateParser } from './shared/custom-date-parser';
1918

@@ -22,7 +21,6 @@ import { CustomDateParser } from './shared/custom-date-parser';
2221
imports: [
2322
CompModule,
2423
TodoModule,
25-
AdminModule,
2624
FormsModule,
2725
ReactiveFormsModule,
2826
HttpClientModule,

src/angular/src/app/comp/navbar/navbar.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<a class="nav-link" [routerLinkActive]="['active']" routerLink="todopage">Todo</a>
1717
</li>
1818
<li class="nav-item">
19-
<a class="nav-link" [routerLinkActive]="['active']" routerLink="adminpage">Admin</a>
19+
<a class="nav-link" [routerLinkActive]="['active']" routerLink="files">Files</a>
2020
</li>
2121
</ul>
2222
<div class="float-right pr-3">
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
import { NgModule } from '@angular/core';
22
import { Routes, RouterModule } from '@angular/router';
3-
import { AdminComponent } from './admin.component';
43

5-
const routes: Routes = [
6-
{
7-
path: '',
8-
component: AdminComponent
9-
}
10-
];
4+
import { FilesComponent } from './files.component';
5+
6+
const routes: Routes = [{ path: '', component: FilesComponent }];
117

128
@NgModule({
139
imports: [RouterModule.forChild(routes)],
1410
exports: [RouterModule]
1511
})
16-
export class AdminRoutingModule {}
12+
export class FilesRoutingModule { }

src/angular/src/app/admin/admin.component.spec.ts renamed to src/angular/src/app/files/files.component.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
22

3-
import { AdminComponent } from './admin.component';
3+
import { FilesComponent } from './files.component';
44

5-
describe('AdminComponent', () => {
6-
let component: AdminComponent;
7-
let fixture: ComponentFixture<AdminComponent>;
5+
describe('FilesComponent', () => {
6+
let component: FilesComponent;
7+
let fixture: ComponentFixture<FilesComponent>;
88

99
beforeEach(async(() => {
1010
TestBed.configureTestingModule({
11-
declarations: [ AdminComponent ]
11+
declarations: [ FilesComponent ]
1212
})
1313
.compileComponents();
1414
}));
1515

1616
beforeEach(() => {
17-
fixture = TestBed.createComponent(AdminComponent);
17+
fixture = TestBed.createComponent(FilesComponent);
1818
component = fixture.componentInstance;
1919
fixture.detectChanges();
2020
});

0 commit comments

Comments
 (0)