1 import { Component } from '@angular/core';
2 import { HTTP_PROVIDERS } from '@angular/http';
3 import { Router, ROUTER_DIRECTIVES } from '@angular/router';
5 import { FriendService } from './friends';
13 import { VideoService } from './videos';
17 template: require('./app.component.html'),
18 styles: [ require('./app.component.scss') ],
19 directives: [ ROUTER_DIRECTIVES, SearchComponent ],
20 providers: [ AuthService, FriendService, HTTP_PROVIDERS, VideoService, SearchService ]
23 export class AppComponent {
28 private authService: AuthService,
29 private friendService: FriendService,
30 private router: Router
32 this.isLoggedIn = this.authService.isLoggedIn();
34 this.authService.loginChangedSource.subscribe(
36 if (status === AuthStatus.LoggedIn) {
37 this.isLoggedIn = true;
43 onSearch(search: Search) {
44 if (search.value !== '') {
50 this.router.navigate(['/videos/list', params]);
52 this.router.navigate(['/videos/list']);
58 // this._authService.logout();
62 this.friendService.makeFriends().subscribe(
65 alert('Already made friends!');
67 alert('Made friends!');
75 this.friendService.quitFriends().subscribe(
77 alert('Quit friends!');