Skip to content
Snippets Groups Projects
Commit ed121d34 authored by Jérémie BRISON's avatar Jérémie BRISON
Browse files

feat(post) : init lazy loading

parent 13b99ad0
No related branches found
No related tags found
3 merge requests!103Recette,!102Dev,!87Feat/posts list
......@@ -87,6 +87,10 @@ const routes: Routes = [
component: FormComponent,
canDeactivate: [DeactivateGuard],
},
{
path: 'posts',
loadChildren: () => import('./posts/posts.module').then((m) => m.PostsModule),
},
{
path: '**',
redirectTo: 'home',
......
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { PostsComponent } from './posts.component';
const routes: Routes = [{ path: '', component: PostsComponent }];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class PostsRoutingModule {}
<p>posts works!</p>
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { PostsComponent } from './posts.component';
describe('PostsComponent', () => {
let component: PostsComponent;
let fixture: ComponentFixture<PostsComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ PostsComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(PostsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-posts',
templateUrl: './posts.component.html',
styleUrls: ['./posts.component.scss']
})
export class PostsComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { PostsComponent } from './posts.component';
import { PostsRoutingModule } from './posts-routing.module';
@NgModule({
declarations: [PostsComponent],
imports: [CommonModule, PostsRoutingModule],
})
export class PostsModule {}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment