currentPage: 1,
itemsPerPage: 9,
total: 0
- }
+ };
sort: SortField;
private search: Search;
this.search = {
value: this._routeParams.get('search'),
field: <SearchField>this._routeParams.get('field')
- }
+ };
this.sort = <SortField>this._routeParams.get('sort') || '-createdDate';
}
onSort(sort: SortField) {
this.sort = sort;
- this._router.navigate(['VideosList', { sort: this.sort }]);
+
+ const params: any = {
+ sort: this.sort
+ };
+
+ if (this.search.value) {
+ params.search = this.search.value;
+ params.field = this.search.field;
+ }
+
+ this._router.navigate(['VideosList', params]);
this.getVideos();
}
}