|
|
@ -1,5 +1,6 @@ |
|
|
|
import { Component, OnInit } from '@angular/core' |
|
|
|
import { Router, NavigationEnd, NavigationStart, ActivatedRoute } from '@angular/router' |
|
|
|
import { DomSanitizer } from '@angular/platform-browser' |
|
|
|
import { Location } from '@angular/common' |
|
|
|
import { ApisService } from '../services/apis.service' |
|
|
|
|
|
|
@ -19,7 +20,8 @@ export class DetailComponent implements OnInit { |
|
|
|
private apisService: ApisService, |
|
|
|
private router: Router, |
|
|
|
private location: Location, |
|
|
|
private activeRoute: ActivatedRoute |
|
|
|
private activeRoute: ActivatedRoute, |
|
|
|
private sanitizer: DomSanitizer |
|
|
|
) { } |
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
@ -33,7 +35,16 @@ export class DetailComponent implements OnInit { |
|
|
|
if(this.history[this.history.length - 1] != `/detail/${section}/${id}`) { |
|
|
|
this.history.push(`/detail/${section}/${id}`) |
|
|
|
} |
|
|
|
this.details = response.item |
|
|
|
|
|
|
|
const detail = response.item |
|
|
|
detail.videos = detail.videos ? JSON.parse(detail.videos) : [] |
|
|
|
detail.videos.forEach((e) => { |
|
|
|
e.code = e.url.split('/').pop() |
|
|
|
e.embed = this.sanitizer.bypassSecurityTrustResourceUrl(`https://www.youtube.com/embed/${e.code}`) |
|
|
|
}) |
|
|
|
this.details = detail |
|
|
|
console.log(response.item) |
|
|
|
|
|
|
|
},(error) => { |
|
|
|
console.error('getPortfolio ERROR', error) |
|
|
|
}).catch((e) => { |
|
|
|