aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-main/video/video.resolver.ts
blob: 65b7230ce803ce5e8cfa48fc7dcfaf06a73d8a65 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { Injectable } from '@angular/core'
import { ActivatedRouteSnapshot, Resolve } from '@angular/router'
import { VideoService } from './video.service'

@Injectable()
export class VideoResolver implements Resolve<any> {
  constructor (
    private videoService: VideoService
  ) {
  }

  resolve (route: ActivatedRouteSnapshot) {
    const videoId: string = route.params['videoId']

    return this.videoService.getVideo({ videoId })
  }
}