aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/search
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/search')
-rw-r--r--client/src/app/shared/search/search.component.ts7
-rw-r--r--client/src/app/shared/search/search.service.ts3
2 files changed, 8 insertions, 2 deletions
diff --git a/client/src/app/shared/search/search.component.ts b/client/src/app/shared/search/search.component.ts
index 219997e85..853f5dc7c 100644
--- a/client/src/app/shared/search/search.component.ts
+++ b/client/src/app/shared/search/search.component.ts
@@ -1,4 +1,5 @@
1import { Component, OnInit } from '@angular/core'; 1import { Component, OnInit } from '@angular/core';
2import { Router } from '@angular/router';
2 3
3import { DROPDOWN_DIRECTIVES} from 'ng2-bootstrap/components/dropdown'; 4import { DROPDOWN_DIRECTIVES} from 'ng2-bootstrap/components/dropdown';
4 5
@@ -25,7 +26,7 @@ export class SearchComponent implements OnInit {
25 value: '' 26 value: ''
26 }; 27 };
27 28
28 constructor(private searchService: SearchService) {} 29 constructor(private searchService: SearchService, private router: Router) {}
29 30
30 ngOnInit() { 31 ngOnInit() {
31 // Subscribe if the search changed 32 // Subscribe if the search changed
@@ -58,6 +59,10 @@ export class SearchComponent implements OnInit {
58 } 59 }
59 60
60 doSearch() { 61 doSearch() {
62 if (this.router.url.indexOf('/videos/list') === -1) {
63 this.router.navigate([ '/videos/list' ]);
64 }
65
61 this.searchService.searchUpdated.next(this.searchCriterias); 66 this.searchService.searchUpdated.next(this.searchCriterias);
62 } 67 }
63 68
diff --git a/client/src/app/shared/search/search.service.ts b/client/src/app/shared/search/search.service.ts
index c7993db3d..717a7fa50 100644
--- a/client/src/app/shared/search/search.service.ts
+++ b/client/src/app/shared/search/search.service.ts
@@ -1,5 +1,6 @@
1import { Injectable } from '@angular/core'; 1import { Injectable } from '@angular/core';
2import { Subject } from 'rxjs/Subject'; 2import { Subject } from 'rxjs/Subject';
3import { ReplaySubject } from 'rxjs/ReplaySubject';
3 4
4import { Search } from './search.model'; 5import { Search } from './search.model';
5 6
@@ -12,6 +13,6 @@ export class SearchService {
12 13
13 constructor() { 14 constructor() {
14 this.updateSearch = new Subject<Search>(); 15 this.updateSearch = new Subject<Search>();
15 this.searchUpdated = new Subject<Search>(); 16 this.searchUpdated = new ReplaySubject<Search>(1);
16 } 17 }
17} 18}