1 import { Component } from '@angular/core';
2 import { HTTP_PROVIDERS } from '@angular/http';
3 import { RouteConfig, Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from '@angular/router-deprecated';
5 import { FriendService } from './friends/index';
6 import { Search, SearchComponent } from './shared/index';
11 } from './users/index';
17 } from './videos/index';
23 component: UserLoginComponent
28 component: VideoListComponent,
32 path: '/videos/watch/:id',
34 component: VideoWatchComponent
39 component: VideoAddComponent
45 templateUrl: 'client/app/app.component.html',
46 styleUrls: [ 'client/app/app.component.css' ],
47 directives: [ ROUTER_DIRECTIVES, SearchComponent ],
48 providers: [ ROUTER_PROVIDERS, HTTP_PROVIDERS, VideoService, FriendService, AuthService ]
51 export class AppComponent {
56 private authService: AuthService,
57 private friendService: FriendService,
58 private router: Router
60 this.isLoggedIn = this.authService.isLoggedIn();
62 this.authService.loginChangedSource.subscribe(
64 if (status === AuthStatus.LoggedIn) {
65 this.isLoggedIn = true;
71 onSearch(search: Search) {
72 if (search.value !== '') {
77 this.router.navigate(['VideosList', params]);
79 this.router.navigate(['VideosList']);
84 // this._authService.logout();
88 this.friendService.makeFriends().subscribe(
91 alert('Already made friends!');
93 alert('Made friends!');
101 this.friendService.quitFriends().subscribe(
103 alert('Quit friends!');
105 error => alert(error)