From 5ad190c9060cc504a69e46ca116a98d2b4c20dc2 Mon Sep 17 00:00:00 2001 From: Art Lowel Date: Thu, 26 Apr 2018 13:37:14 +0200 Subject: [PATCH] fixed an issue where the search form wouldn't work on any page but the search page --- src/app/shared/search-form/search-form.component.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/shared/search-form/search-form.component.ts b/src/app/shared/search-form/search-form.component.ts index ed7572f94d..5fd984a731 100644 --- a/src/app/shared/search-form/search-form.component.ts +++ b/src/app/shared/search-form/search-form.component.ts @@ -2,7 +2,7 @@ import { Component, Input } from '@angular/core'; import { SearchService } from '../../+search-page/search-service/search.service'; import { DSpaceObject } from '../../core/shared/dspace-object.model'; import { Router } from '@angular/router'; -import { isNotEmpty, hasValue, isEmpty } from '../empty.util'; +import { isNotEmpty, hasValue, isEmpty, hasNoValue } from '../empty.util'; /** * This component renders a simple item page. @@ -34,7 +34,8 @@ export class SearchFormComponent { } updateSearch(data: any) { - this.router.navigate([this.currentUrl], { + const newUrl = hasValue(this.currentUrl) ? this.currentUrl : 'search'; + this.router.navigate([newUrl], { queryParams: { query: data.query, scope: data.scope || undefined,