1 import { Component, ElementRef } from 'angular2/core';
2 import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, Router } from 'angular2/router';
3 import { HTTP_PROVIDERS } from 'angular2/http';
5 import { VideosAddComponent } from '../videos/components/add/videos-add.component';
6 import { VideosListComponent } from '../videos/components/list/videos-list.component';
7 import { VideosWatchComponent } from '../videos/components/watch/videos-watch.component';
8 import { VideosService } from '../videos/services/videos.service';
9 import { FriendsService } from '../friends/services/friends.service';
15 component: VideosListComponent,
19 path: '/videos/watch/:id',
21 component: VideosWatchComponent
26 component: VideosAddComponent
32 templateUrl: 'app/angular/app/app.component.html',
33 styleUrls: [ 'app/angular/app/app.component.css' ],
34 directives: [ ROUTER_DIRECTIVES ],
35 providers: [ ROUTER_PROVIDERS, HTTP_PROVIDERS, ElementRef, VideosService, FriendsService ]
38 export class AppComponent {
39 constructor(private _friendsService: FriendsService, private _router: Router) {}
41 doSearch(search: string) {
43 this._router.navigate(['VideosList', { search: search }]);
45 this._router.navigate(['VideosList']);
50 this._friendsService.makeFriends().subscribe(
53 alert('Already made friends!');
55 alert('Made friends!');
63 this._friendsService.quitFriends().subscribe(
65 alert('Quit friends!');