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
42 template: require('./app.component.html'),
43 styles: [ require('./app.component.scss') ],
44 directives: [ ROUTER_DIRECTIVES, SearchComponent ],
45 providers: [ AuthService, FriendService, HTTP_PROVIDERS, ROUTER_PROVIDERS, VideoService, SearchService ]
48 export class AppComponent {
53 private authService: AuthService,
54 private friendService: FriendService,
55 private router: Router
57 this.isLoggedIn = this.authService.isLoggedIn();
59 this.authService.loginChangedSource.subscribe(
61 if (status === AuthStatus.LoggedIn) {
62 this.isLoggedIn = true;
68 onSearch(search: Search) {
69 if (search.value !== '') {
74 this.router.navigate(['/videos/list', params]);
76 this.router.navigate(['/videos/list']);
82 // this._authService.logout();
86 this.friendService.makeFriends().subscribe(
89 alert('Already made friends!');
91 alert('Made friends!');
99 this.friendService.quitFriends().subscribe(
101 alert('Quit friends!');
103 error => alert(error)