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';
6 import { LoginComponent } from './login';
24 component: LoginComponent
29 component: VideoListComponent,
33 path: '/videos/watch/:id',
35 component: VideoWatchComponent
40 component: VideoAddComponent
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 ]
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(['VideosList', params]);
80 this.router.navigate(['VideosList']);
85 // this._authService.logout();
89 this.friendService.makeFriends().subscribe(
92 alert('Already made friends!');
94 alert('Made friends!');
102 this.friendService.quitFriends().subscribe(
104 alert('Quit friends!');
106 error => alert(error)