1 import { Component, OnInit } from 'angular2/core';
2 import { ROUTER_DIRECTIVES, RouteParams } from 'angular2/router';
4 import { AuthService } from '../../../users/services/auth.service';
5 import { User } from '../../../users/models/user';
6 import { VideosService } from '../../services/videos.service';
7 import { Video } from '../../models/video';
10 selector: 'my-videos-list',
11 styleUrls: [ 'app/angular/videos/components/list/videos-list.component.css' ],
12 templateUrl: 'app/angular/videos/components/list/videos-list.component.html',
13 directives: [ ROUTER_DIRECTIVES ]
16 export class VideosListComponent implements OnInit {
20 private search: string;
23 private _authService: AuthService,
24 private _videosService: VideosService,
25 routeParams: RouteParams
27 this.search = routeParams.get('search');
31 if (this._authService.isLoggedIn()) {
32 this.user = User.load();
39 let observable = null;
41 if (this.search !== null) {""
42 observable = this._videosService.searchVideos(this.search);
44 observable = this._videosService.getVideos();
48 videos => this.videos = videos,
53 removeVideo(id: string) {
54 this._videosService.removeVideo(id).subscribe(
55 status => this.getVideos(),