mirror of https://github.com/Chocobozzz/PeerTube
Client: navigate to /videos/list when do search on another page
parent
e105c19c8e
commit
9aa46b0c7b
|
@ -1,4 +1,5 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
import { DROPDOWN_DIRECTIVES} from 'ng2-bootstrap/components/dropdown';
|
import { DROPDOWN_DIRECTIVES} from 'ng2-bootstrap/components/dropdown';
|
||||||
|
|
||||||
|
@ -25,7 +26,7 @@ export class SearchComponent implements OnInit {
|
||||||
value: ''
|
value: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(private searchService: SearchService) {}
|
constructor(private searchService: SearchService, private router: Router) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
// Subscribe if the search changed
|
// Subscribe if the search changed
|
||||||
|
@ -58,6 +59,10 @@ export class SearchComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
doSearch() {
|
doSearch() {
|
||||||
|
if (this.router.url.indexOf('/videos/list') === -1) {
|
||||||
|
this.router.navigate([ '/videos/list' ]);
|
||||||
|
}
|
||||||
|
|
||||||
this.searchService.searchUpdated.next(this.searchCriterias);
|
this.searchService.searchUpdated.next(this.searchCriterias);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Subject } from 'rxjs/Subject';
|
import { Subject } from 'rxjs/Subject';
|
||||||
|
import { ReplaySubject } from 'rxjs/ReplaySubject';
|
||||||
|
|
||||||
import { Search } from './search.model';
|
import { Search } from './search.model';
|
||||||
|
|
||||||
|
@ -12,6 +13,6 @@ export class SearchService {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.updateSearch = new Subject<Search>();
|
this.updateSearch = new Subject<Search>();
|
||||||
this.searchUpdated = new Subject<Search>();
|
this.searchUpdated = new ReplaySubject<Search>(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue