1 import { Component, OnInit } from 'angular2/core';
2 import { ROUTER_DIRECTIVES, RouteParams } from 'angular2/router';
4 import { VideosService } from '../../services/videos.service';
5 import { Video } from '../../models/video';
8 selector: 'my-videos-list',
9 styleUrls: [ 'app/angular/videos/components/list/videos-list.component.css' ],
10 templateUrl: 'app/angular/videos/components/list/videos-list.component.html',
11 directives: [ ROUTER_DIRECTIVES ]
14 export class VideosListComponent implements OnInit {
17 private search: string;
20 private _videosService: VideosService,
21 routeParams: RouteParams
23 this.search = routeParams.get('search');
31 let observable = null;
33 if (this.search !== null) {
34 observable = this._videosService.searchVideos(this.search);
36 observable = this._videosService.getVideos();
40 videos => this.videos = videos,
45 removeVideo(id: string) {
46 this._videosService.removeVideo(id).subscribe(
47 status => this.getVideos(),