1 import { Component } from '@angular/core';
2 import { HTTP_PROVIDERS } from '@angular/http';
3 import { Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, Routes } from '@angular/router';
5 import { FriendService } from './friends';
6 import { LoginComponent } from './login';
19 import { SearchService } from './shared'; // Temporary
24 component: LoginComponent
28 component: VideoListComponent
31 path: '/videos/watch/:id',
32 component: VideoWatchComponent
36 component: VideoAddComponent
40 component: VideoListComponent
46 template: require('./app.component.html'),
47 styles: [ require('./app.component.scss') ],
48 directives: [ ROUTER_DIRECTIVES, SearchComponent ],
49 providers: [ AuthService, FriendService, HTTP_PROVIDERS, ROUTER_PROVIDERS, VideoService, SearchService ]
52 export class AppComponent {
57 private authService: AuthService,
58 private friendService: FriendService,
59 private router: Router
61 this.isLoggedIn = this.authService.isLoggedIn();
63 this.authService.loginChangedSource.subscribe(
65 if (status === AuthStatus.LoggedIn) {
66 this.isLoggedIn = true;
72 onSearch(search: Search) {
73 if (search.value !== '') {
78 this.router.navigate(['/videos/list', params]);
80 this.router.navigate(['/videos/list']);
86 // this._authService.logout();
90 this.friendService.makeFriends().subscribe(
93 alert('Already made friends!');
95 alert('Made friends!');
103 this.friendService.quitFriends().subscribe(
105 alert('Quit friends!');
107 error => alert(error)