Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
125
rated 0 times [  126] [ 1]  / answers: 1 / hits: 16210  / 11 Years ago, fri, november 1, 2013, 12:00:00

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>


and the 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?


More From » html

 Answers
13

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);
}])


You may also check the doc here.


[#74560] Thursday, October 31, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
shelbiec

Total Points: 101
Total Questions: 106
Total Answers: 106

Location: Ivory Coast
Member since Fri, Oct 8, 2021
3 Years ago
;