diff options
Diffstat (limited to 'client/angular/app/app.component.ts')
-rw-r--r-- | client/angular/app/app.component.ts | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/client/angular/app/app.component.ts b/client/angular/app/app.component.ts index 3d41183f2..cb961a3c8 100644 --- a/client/angular/app/app.component.ts +++ b/client/angular/app/app.component.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Component, ElementRef } from 'angular2/core'; | 1 | import { Component, ElementRef } from 'angular2/core'; |
2 | import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from 'angular2/router'; | 2 | import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, Router } from 'angular2/router'; |
3 | import {HTTP_PROVIDERS} from 'angular2/http'; | 3 | import { HTTP_PROVIDERS } from 'angular2/http'; |
4 | 4 | ||
5 | import { VideosAddComponent } from '../videos/components/add/videos-add.component'; | 5 | import { VideosAddComponent } from '../videos/components/add/videos-add.component'; |
6 | import { VideosListComponent } from '../videos/components/list/videos-list.component'; | 6 | import { VideosListComponent } from '../videos/components/list/videos-list.component'; |
@@ -36,15 +36,22 @@ import { FriendsService } from '../friends/services/friends.service'; | |||
36 | }) | 36 | }) |
37 | 37 | ||
38 | export class AppComponent { | 38 | export class AppComponent { |
39 | constructor(private _friendsService: FriendsService) {} | 39 | constructor(private _friendsService: FriendsService, private _router: Router) {} |
40 | |||
41 | doSearch(search: string) { | ||
42 | if (search !== '') { | ||
43 | this._router.navigate(['VideosList', { search: search }]); | ||
44 | } else { | ||
45 | this._router.navigate(['VideosList']); | ||
46 | } | ||
47 | } | ||
40 | 48 | ||
41 | makeFriends() { | 49 | makeFriends() { |
42 | this._friendsService.makeFriends().subscribe( | 50 | this._friendsService.makeFriends().subscribe( |
43 | status => { | 51 | status => { |
44 | if (status === 409) { | 52 | if (status === 409) { |
45 | alert('Already made friends!'); | 53 | alert('Already made friends!'); |
46 | } | 54 | } else { |
47 | else { | ||
48 | alert('Made friends!'); | 55 | alert('Made friends!'); |
49 | } | 56 | } |
50 | }, | 57 | }, |