import { Component, OnInit } from '@angular/core';
+import { Router } from '@angular/router';
import { DROPDOWN_DIRECTIVES} from 'ng2-bootstrap/components/dropdown';
value: ''
};
- constructor(private searchService: SearchService) {}
+ constructor(private searchService: SearchService, private router: Router) {}
ngOnInit() {
// Subscribe if the search changed
}
doSearch() {
+ if (this.router.url.indexOf('/videos/list') === -1) {
+ this.router.navigate([ '/videos/list' ]);
+ }
+
this.searchService.searchUpdated.next(this.searchCriterias);
}
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs/Subject';
+import { ReplaySubject } from 'rxjs/ReplaySubject';
import { Search } from './search.model';
constructor() {
this.updateSearch = new Subject<Search>();
- this.searchUpdated = new Subject<Search>();
+ this.searchUpdated = new ReplaySubject<Search>(1);
}
}