1 import { Component, OnDestroy, OnInit } from '@angular/core'
2 import { ActivatedRoute, Router } from '@angular/router'
3 import { NotificationsService } from 'angular2-notifications'
4 import { AbstractVideoList } from 'app/shared/video/abstract-video-list'
5 import { Subscription } from 'rxjs/Subscription'
6 import { SortField } from '../../shared/video/sort-field.type'
7 import { VideoService } from '../../shared/video/video.service'
10 selector: 'my-videos-search',
11 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
12 templateUrl: '../../shared/video/abstract-video-list.html'
14 export class VideoSearchComponent extends AbstractVideoList implements OnInit, OnDestroy {
16 currentRoute = '/videos/search'
20 private subActivatedRoute: Subscription
22 constructor (protected router: Router,
23 protected route: ActivatedRoute,
24 protected notificationsService: NotificationsService,
25 private videoService: VideoService) {
32 this.subActivatedRoute = this.route.queryParams.subscribe(
34 this.search = queryParams['search']
38 err => this.notificationsService.error('Error', err.text)
43 if (this.subActivatedRoute) {
44 this.subActivatedRoute.unsubscribe()
48 getVideosObservable () {
49 return this.videoService.searchVideos(this.search, this.pagination, this.sort)