diff options
Diffstat (limited to 'client/src/app/shared/search/search.component.ts')
-rw-r--r-- | client/src/app/shared/search/search.component.ts | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/client/src/app/shared/search/search.component.ts b/client/src/app/shared/search/search.component.ts deleted file mode 100644 index f49ecc8ad..000000000 --- a/client/src/app/shared/search/search.component.ts +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | ||
2 | import { Router } from '@angular/router' | ||
3 | import { Search } from './search.model' | ||
4 | import { SearchService } from './search.service' | ||
5 | |||
6 | @Component({ | ||
7 | selector: 'my-search', | ||
8 | templateUrl: './search.component.html', | ||
9 | styleUrls: [ './search.component.scss' ] | ||
10 | }) | ||
11 | |||
12 | export class SearchComponent implements OnInit { | ||
13 | searchCriteria: Search = { | ||
14 | field: 'name', | ||
15 | value: '' | ||
16 | } | ||
17 | |||
18 | constructor (private searchService: SearchService, private router: Router) {} | ||
19 | |||
20 | ngOnInit () { | ||
21 | // Subscribe if the search changed | ||
22 | // Usually changed by videos list component | ||
23 | this.searchService.updateSearch.subscribe( | ||
24 | newSearchCriteria => { | ||
25 | // Put a field by default | ||
26 | if (!newSearchCriteria.field) { | ||
27 | newSearchCriteria.field = 'name' | ||
28 | } | ||
29 | |||
30 | this.searchCriteria = newSearchCriteria | ||
31 | } | ||
32 | ) | ||
33 | } | ||
34 | |||
35 | doSearch () { | ||
36 | // if (this.router.url.indexOf('/videos/list') === -1) { | ||
37 | // this.router.navigate([ '/videos/list' ]) | ||
38 | // } | ||
39 | |||
40 | this.searchService.searchUpdated.next(this.searchCriteria) | ||
41 | } | ||
42 | } | ||