本文介绍了角$ SCE挡住了我的声音一滴SRC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用的角度ngRepeat与HTML5音频标记。
我有HTML:
I am trying to use angular ngRepeat with the html5 audio tag.I have the html:
<li ng-repeat="recordings in recordinglist">
<audio controls ng-src="{{recordings}}"></audio>
</li>
和JS的:
$scope.$apply($scope.recordinglist.push("blob:http%3A//localhost%3A9000/67ecfa65-3394-45a6-8f29-42f3421a2727"));
但棱角分明的同一产地的检查导致错误时插补抛出:
But angular's same origin checking is causing an error to be thrown on interpolation:
Error: [$interpolate:interr] Can't interpolate: {{recordings}}
Error: [$sce:insecurl] Blocked loading resource from url not allowed by $sceDelegate policy. URL: blob:http%3A//localhost%3A9000/67ecfa65-3394-45a6-8f29-42f3421a2727
这似乎只是愚蠢。这不是插值的本地资源。我想有一种方法可以正确做到这一点 - 或者我应该提交错误报告
This just seems silly. It's not interpolating a local resource. I imagine there's a way to do this correctly - or should I file a bug report?
推荐答案
我有同样的问题,尝试前显示以实现WebRTC视频一个blob SRC的时候,我用的 $ SCE固定它服务
I have the same problem when trying to display a blob src for webrtc video before, and I fixed it by using $sce service:
angular.module('moduleName', ['ngSanitize'])
.controller('ctrName', ['$sce', function($sce) {
$scope.recordings = $sce.trustAsResourceUrl(recordings);
}])
您还可以在这里查看该文档。 。$ SCE
You may also check the doc here. http://docs.angularjs.org/api/ng.$sce
这篇关于角$ SCE挡住了我的声音一滴SRC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!