From 76f2a7c8df52dfae0941001ad97aa0e068cec660 Mon Sep 17 00:00:00 2001 From: mustafahlvc Date: Thu, 27 Jul 2017 00:41:11 +0300 Subject: [PATCH] (Todo App) some fixes about tag routing etc.. --- .../todo/sidenavs/main/main-sidenav.component.ts | 4 +--- .../apps/todo/todo-details/todo-details.component.ts | 5 ++++- .../main/apps/todo/todo-list/todo-list.component.ts | 12 ++++++------ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/app/main/apps/todo/sidenavs/main/main-sidenav.component.ts b/src/app/main/apps/todo/sidenavs/main/main-sidenav.component.ts index c84e6deb..f9aaaf47 100644 --- a/src/app/main/apps/todo/sidenavs/main/main-sidenav.component.ts +++ b/src/app/main/apps/todo/sidenavs/main/main-sidenav.component.ts @@ -15,7 +15,6 @@ export class MainSidenavComponent implements OnInit, OnDestroy accounts: object; selectedAccount: string; - // onFoldersChanged: Subscription; onFiltersChanged: Subscription; onTagsChanged: Subscription; @@ -47,8 +46,7 @@ export class MainSidenavComponent implements OnInit, OnDestroy ngOnDestroy() { - // this.onFoldersChanged.unsubscribe(); this.onFiltersChanged.unsubscribe(); - // this.onTagsChanged.unsubscribe(); + this.onTagsChanged.unsubscribe(); } } diff --git a/src/app/main/apps/todo/todo-details/todo-details.component.ts b/src/app/main/apps/todo/todo-details/todo-details.component.ts index 59a3c3c0..c57e2852 100644 --- a/src/app/main/apps/todo/todo-details/todo-details.component.ts +++ b/src/app/main/apps/todo/todo-details/todo-details.component.ts @@ -122,7 +122,10 @@ export class TodoDetailsComponent implements OnInit, OnDestroy ngOnDestroy() { - this.onFormChange.unsubscribe(); + if ( this.onFormChange ) + { + this.onFormChange.unsubscribe(); + } this.onCurrentTodoChanged.unsubscribe(); } } diff --git a/src/app/main/apps/todo/todo-list/todo-list.component.ts b/src/app/main/apps/todo/todo-list/todo-list.component.ts index 9a26a6b5..97aadda6 100644 --- a/src/app/main/apps/todo/todo-list/todo-list.component.ts +++ b/src/app/main/apps/todo/todo-list/todo-list.component.ts @@ -43,12 +43,12 @@ export class TodoListComponent implements OnInit, OnDestroy this.currentTodo = null; // Handle the location changes - const tagId = this.route.snapshot.params.tagId, + const tagHandle = this.route.snapshot.params.tagHandle, filterHandle = this.route.snapshot.params.filterHandle; - if ( tagId ) + if ( tagHandle ) { - this.location.go('apps/todo/tag/' + tagId); + this.location.go('apps/todo/tag/' + tagHandle); } else if ( filterHandle ) { @@ -74,12 +74,12 @@ export class TodoListComponent implements OnInit, OnDestroy */ readTodo(todoId) { - const tagId = this.route.snapshot.params.tagId, + const tagHandle = this.route.snapshot.params.tagHandle, filterHandle = this.route.snapshot.params.filterHandle; - if ( tagId ) + if ( tagHandle ) { - this.location.go('apps/todo/tag/' + tagId + '/' + todoId); + this.location.go('apps/todo/tag/' + tagHandle + '/' + todoId); } else if ( filterHandle ) {