From d86d172dee1e4fe1db72639b208203c9eb3a5de8 Mon Sep 17 00:00:00 2001 From: Jens Ulferts Date: Thu, 4 May 2017 11:25:54 +0200 Subject: [PATCH] ui-router for handled link, $window.location for rest This e.g. fixes exporting to pdf as the ui router does not handle this link --- .../app/components/routing/wp-show/wp-show.controller.ts | 7 ++++++- .../components/wp-details/wp-details-toolbar.directive.ts | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/frontend/app/components/routing/wp-show/wp-show.controller.ts b/frontend/app/components/routing/wp-show/wp-show.controller.ts index 3aa06206d9..84c7f8f4e1 100644 --- a/frontend/app/components/routing/wp-show/wp-show.controller.ts +++ b/frontend/app/components/routing/wp-show/wp-show.controller.ts @@ -92,7 +92,12 @@ export class WorkPackageShowController extends WorkPackageViewController { this.deleteSelectedWorkPackage(); break; default: - this.$location.path(link); + var stateForLink = $state.get().filter(state => state.$$state().url.exec(link)); + if (stateForLink.length > 0) { + this.$location.path(link); + } else { + this.$window.location.href = link; + } break; } }; diff --git a/frontend/app/components/wp-details/wp-details-toolbar.directive.ts b/frontend/app/components/wp-details/wp-details-toolbar.directive.ts index e31c42221a..b95e39f61a 100644 --- a/frontend/app/components/wp-details/wp-details-toolbar.directive.ts +++ b/frontend/app/components/wp-details/wp-details-toolbar.directive.ts @@ -103,7 +103,12 @@ function wpDetailsToolbar( deleteSelectedWorkPackage(); break; default: - $location.path(link); + var stateForLink = $state.get().filter(state => state.$$state().url.exec(link)); + if (stateForLink.length > 0) { + $location.path(link); + } else { + $window.location.href = link; + } break; } };