【发布时间】:2017-11-09 04:36:51
【问题描述】:
我正在尝试使用我尝试过的 angular 2 动态更改 iframe 的 src
HTML
<iframe class="controls" width="580" height="780" src="{{controllerSrc}}" frameborder="0" allowfullscreen></iframe>
组件.TS
import { Component, OnInit } from '@angular/core';
declare var jQuery: any;
const $ = jQuery;
export class VideoplayerComponent implements OnInit {
controllerSrc: string;
ngOnit(){
$('.button1').click(function(){
this.controllerSrc = 'https://www.videoindexer.ai/embed/insights/0c7357bd5c/?widgets=people';
});
}
}
但我收到一个错误提示
ERROR Error: unsafe value used in a resource URL context (see http://g.co/ng/security#xss)
不知道我还能如何做到这一点,任何帮助将不胜感激,
谢谢
【问题讨论】:
标签: javascript angular typescript iframe