我正在从NASA的API之一中获取数据;这个有一段视频。获取的对象:
{copyright: "Jean-Luc etc, …}
copyright
:
"Jean-Luc DauvergneCiel et Espace"
date
:
"2018-07-10"
explanation
:
"It's northern noctilucent etc"
media_type
:
"video"
service_version
:
"v1"
title
:
"Noctilucent Clouds over Paris Fireworks"
url
:
"https://www.youtube.com/embed/8i8-IuYoz24?rel=0"
我遵循了这个post,但是最后我得到了这个错误:
所以,我缺少了什么,有人可以帮我吗?我正在使用的代码:
HTML
<div class="container" *ngIf="dayPicture">
<div class="col">
<iframe [src]='safeURL' frameborder="0" allowfullscreen></iframe>
</div>
</div>
组件:
export class MainComponent implements OnInit {
dayPicture: any[];
safeURL: any;
constructor(private nasaService: NasaService, videoURL: string, private _sanitizer: DomSanitizer) {
this.safeURL = this._sanitizer.bypassSecurityTrustResourceUrl(videoURL);
this.getPicture();
}
ngOnInit() {
}
getPicture() {
this.nasaService.getPicture()
.subscribe(data => {
this.dayPicture = data;
console.log(this.dayPicture);
};