1 import { Component, OnDestroy, OnInit } from '@angular/core'
2 import { ActivatedRoute, Router } from '@angular/router'
3 import { NotificationsService } from 'angular2-notifications'
4 import { Subscription } from 'rxjs/Subscription'
5 import { AbstractVideoList } from '../../shared/video/abstract-video-list'
6 import { VideoService } from '../../shared/video/video.service'
9 selector: 'my-videos-search',
10 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
11 templateUrl: '../../shared/video/abstract-video-list.html'
13 export class VideoSearchComponent extends AbstractVideoList implements OnInit, OnDestroy {
15 currentRoute = '/videos/search'
19 private subActivatedRoute: Subscription
21 constructor (protected router: Router,
22 protected route: ActivatedRoute,
23 protected notificationsService: NotificationsService,
24 private videoService: VideoService) {
31 this.subActivatedRoute = this.route.queryParams.subscribe(
33 this.search = queryParams['search']
37 err => this.notificationsService.error('Error', err.text)
42 if (this.subActivatedRoute) {
43 this.subActivatedRoute.unsubscribe()
47 getVideosObservable () {
48 return this.videoService.searchVideos(this.search, this.pagination, this.sort)