我的AngularJS 2应用程序有问题(我使用的是AngularJS 2的RC5版本).似乎已清理的URL正在触发更改检测,然后更新div以下内容,尽管我的组件状态没有任何更改.
从用户的角度来看,这表现为视频在播放时的重新加载.
所以在我的组件视图中我有:
<div *ngIf="isVideo(item)">
<iframe [src]="getTrustedYouTubeUrl(item)" scrolling="no" frameborder="0" allowfullscreen></iframe>
</div>
Run Code Online (Sandbox Code Playgroud)
上面组件代码中函数的实现是:
getTrustedYouTubeUrl(linkedVideo:LinkedVideoModel) {
return this.sanitizer.bypassSecurityTrustResourceUrl(linkedVideo.video.url);
}
Run Code Online (Sandbox Code Playgroud)
在调试器中,我看到div通过AngularJS 2框架中触发的内容经常刷新.
如果我用硬编码的URL替换上面的HTML代码段,问题就会消失:
<div *ngIf="isVideo(item)">
<iframe src="<hardcoded youtube url here>" scrolling="no" frameborder="0" allowfullscreen></iframe>
</div>
Run Code Online (Sandbox Code Playgroud)
所以我怀疑URL清理导致了它.
谁能指出我正确的方向?嵌入式YouTube视频的工作示例可能是哪些网址绑定到组件上的属性?
这是我的场景:
我希望能够创建像这样的内容
<div> <a id="supportTile" class="contentModule" href="/Support"> <h2>支持</ h2> </a> </ div>
但是,tinyMCE剥离它
<div> <h2>支持</ h2> </ div>
我的配置目前是这样的(使用TinyMCE jQuery):
Run Code Online (Sandbox Code Playgroud)script_url: _applicationRoot + "Scripts/tiny_mce/tiny_mce.js", theme: "advanced", plugins: "paste,filemanager,imagemanager,advimage,inlinepopups", ... extended_valid_elements: "img[!src|border:0|alt|title|width|height|style|name|id|class],a[href|target|title|onclick|name|id|class],article[name|id|class],div[name|id|class],section[name|id|class]", schema: "html5", ... convert_urls: true, document_base_url: _applicationRoot
我尝试设置verify_html:false但没有运气.
我尝试删除extended_valid_elements并将其替换为:
Run Code Online (Sandbox Code Playgroud)valid_elements: "*[*]", verify_html: false
也没有运气.
你能看到我的配置有问题吗?这可以实现吗?
谢谢!