diff options
Diffstat (limited to 'client/angular/app/app.component.ts')
-rw-r--r-- | client/angular/app/app.component.ts | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/client/angular/app/app.component.ts b/client/angular/app/app.component.ts index a105ed26a..513830d6b 100644 --- a/client/angular/app/app.component.ts +++ b/client/angular/app/app.component.ts | |||
@@ -2,6 +2,8 @@ import { Component } from '@angular/core'; | |||
2 | import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, Router } from '@angular/router-deprecated'; | 2 | import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, Router } from '@angular/router-deprecated'; |
3 | import { HTTP_PROVIDERS } from '@angular/http'; | 3 | import { HTTP_PROVIDERS } from '@angular/http'; |
4 | 4 | ||
5 | import { DROPDOWN_DIRECTIVES} from 'ng2-bootstrap/components/dropdown'; | ||
6 | |||
5 | import { VideosAddComponent } from '../videos/components/add/videos-add.component'; | 7 | import { VideosAddComponent } from '../videos/components/add/videos-add.component'; |
6 | import { VideosListComponent } from '../videos/components/list/videos-list.component'; | 8 | import { VideosListComponent } from '../videos/components/list/videos-list.component'; |
7 | import { VideosWatchComponent } from '../videos/components/watch/videos-watch.component'; | 9 | import { VideosWatchComponent } from '../videos/components/watch/videos-watch.component'; |
@@ -10,6 +12,8 @@ import { FriendsService } from '../friends/services/friends.service'; | |||
10 | import { UserLoginComponent } from '../users/components/login/login.component'; | 12 | import { UserLoginComponent } from '../users/components/login/login.component'; |
11 | import { AuthService } from '../users/services/auth.service'; | 13 | import { AuthService } from '../users/services/auth.service'; |
12 | import { AuthStatus } from '../users/models/authStatus'; | 14 | import { AuthStatus } from '../users/models/authStatus'; |
15 | import { SearchComponent } from './search.component'; | ||
16 | import { Search } from './search'; | ||
13 | 17 | ||
14 | @RouteConfig([ | 18 | @RouteConfig([ |
15 | { | 19 | { |
@@ -39,12 +43,14 @@ import { AuthStatus } from '../users/models/authStatus'; | |||
39 | selector: 'my-app', | 43 | selector: 'my-app', |
40 | templateUrl: 'app/angular/app/app.component.html', | 44 | templateUrl: 'app/angular/app/app.component.html', |
41 | styleUrls: [ 'app/angular/app/app.component.css' ], | 45 | styleUrls: [ 'app/angular/app/app.component.css' ], |
42 | directives: [ ROUTER_DIRECTIVES ], | 46 | directives: [ ROUTER_DIRECTIVES, SearchComponent ], |
43 | providers: [ ROUTER_PROVIDERS, HTTP_PROVIDERS, VideosService, FriendsService, AuthService ] | 47 | providers: [ ROUTER_PROVIDERS, HTTP_PROVIDERS, VideosService, FriendsService, AuthService ] |
44 | }) | 48 | }) |
45 | 49 | ||
46 | export class AppComponent { | 50 | export class AppComponent { |
47 | isLoggedIn: boolean; | 51 | isLoggedIn: boolean; |
52 | search_field: string = name; | ||
53 | choices = [ ]; | ||
48 | 54 | ||
49 | constructor(private _friendsService: FriendsService, | 55 | constructor(private _friendsService: FriendsService, |
50 | private _authService: AuthService, | 56 | private _authService: AuthService, |
@@ -61,9 +67,10 @@ export class AppComponent { | |||
61 | ); | 67 | ); |
62 | } | 68 | } |
63 | 69 | ||
64 | doSearch(search: string) { | 70 | onSearch(search: Search) { |
65 | if (search !== '') { | 71 | console.log(search); |
66 | this._router.navigate(['VideosList', { search: search }]); | 72 | if (search.value !== '') { |
73 | this._router.navigate(['VideosList', { search: search.value, field: search.field }]); | ||
67 | } else { | 74 | } else { |
68 | this._router.navigate(['VideosList']); | 75 | this._router.navigate(['VideosList']); |
69 | } | 76 | } |