1 import { Component } from '@angular/core';
2 import { ActivatedRoute, Router, ROUTER_DIRECTIVES } from '@angular/router';
4 import { FriendService } from './friends';
11 import { VideoService } from './videos';
15 template: require('./app.component.html'),
16 styles: [ require('./app.component.scss') ],
17 directives: [ ROUTER_DIRECTIVES, SearchComponent ],
18 providers: [ FriendService, VideoService, SearchService ]
21 export class AppComponent {
26 private authService: AuthService,
27 private friendService: FriendService,
28 private route: ActivatedRoute,
29 private router: Router
31 this.isLoggedIn = this.authService.isLoggedIn();
33 this.authService.loginChangedSource.subscribe(
35 if (status === AuthStatus.LoggedIn) {
36 this.isLoggedIn = true;
37 console.log('Logged in.');
38 } else if (status === AuthStatus.LoggedOut) {
39 this.isLoggedIn = false;
40 console.log('Logged out.');
42 console.error('Unknown auth status: ' + status);
49 this.authService.logout();
53 this.friendService.makeFriends().subscribe(
56 alert('Already made friends!');
58 alert('Made friends!');
66 this.friendService.quitFriends().subscribe(
68 alert('Quit friends!');