From 7a4b9c6ab4501fbc15dc96a3ae70f8e607b93e49 Mon Sep 17 00:00:00 2001 From: Hieu Nguyen Date: Tue, 9 Aug 2022 10:52:23 +0700 Subject: [PATCH] #5 - fix post list routing params --- src/app/pages/home/home.component.html | 2 +- src/app/pages/home/home.component.ts | 3 +-- src/app/post/post-list/post-list.component.ts | 3 +-- src/app/post/post-routing.module.ts | 2 +- src/app/shared/navbar/navbar.component.html | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/app/pages/home/home.component.html b/src/app/pages/home/home.component.html index fd6dfc8..568360a 100644 --- a/src/app/pages/home/home.component.html +++ b/src/app/pages/home/home.component.html @@ -13,7 +13,7 @@
diff --git a/src/app/pages/home/home.component.ts b/src/app/pages/home/home.component.ts index 7b90caa..aea2615 100644 --- a/src/app/pages/home/home.component.ts +++ b/src/app/pages/home/home.component.ts @@ -98,8 +98,7 @@ export class HomeComponent implements OnInit { this.tech_list = res.items; this.tech_list.forEach(elm => { var title = elm['title']; - var first = title.replace("'", "'"); - var second = first.replace("'", "'"); + var second = title.split("'").join("'"); elm['title'] = second; }); console.log("tech", res); diff --git a/src/app/post/post-list/post-list.component.ts b/src/app/post/post-list/post-list.component.ts index 275def0..56bfbb5 100644 --- a/src/app/post/post-list/post-list.component.ts +++ b/src/app/post/post-list/post-list.component.ts @@ -47,8 +47,7 @@ export class PostListComponent implements OnInit { this.posts_list = res.items; this.posts_list.forEach(elm => { var title = elm['title']; - var first = title.replace("'", "'"); - var second = first.replace("'", "'"); + var second =title.split("'").join("'"); elm['title'] = second; }); diff --git a/src/app/post/post-routing.module.ts b/src/app/post/post-routing.module.ts index 44cdd74..921bca8 100644 --- a/src/app/post/post-routing.module.ts +++ b/src/app/post/post-routing.module.ts @@ -6,7 +6,7 @@ import { SearchResultComponent } from './search-result/search-result.component'; const routes: Routes = [ { path: 'search/:keyword/:tag', component: SearchResultComponent }, - { path: ':title', component: PostListComponent } + { path: 'chu-de/:title', component: PostListComponent } ]; @NgModule({ diff --git a/src/app/shared/navbar/navbar.component.html b/src/app/shared/navbar/navbar.component.html index fdd426d..dc90a99 100644 --- a/src/app/shared/navbar/navbar.component.html +++ b/src/app/shared/navbar/navbar.component.html @@ -56,7 +56,7 @@ Tin nĂ³ng