AngularJS ionic - Error in iframe when trying to play a video

。_饼干妹妹 提交于 2019-12-23 02:05:08

问题


These are my errors: Error: [$interpolate:interr] Can't interpolate: {{ videourl }} Error: [$sce:insecurl] Blocked loading resource from url not allowed by $sceDelegate policy.

Error: [$interpolate:interr] Can't interpolate: {{ videourl }} Error: [$sce:insecurl] Blocked loading resource from url not allowed by $sceDelegate policy.

When I add in this code which I get from research...

$sceDelegateProvider.resourceUrlWhitelist([
  'self',   
  'http://tvstartup.biz/**']);
  $scope.trustSrc = function(src) {
    return $sce.trustAsResourceUrl(src);
  }

...I get this error:

 `ReferenceError: $sceDelegateProvider is not defined at new <anonymous> (/js/app.js:295:1) at Object.instantiate (/lib/ionic/js/ionic.bundle.js:18010:14) at $controller (/lib/ionic/js/ionic.bundle.js:23412:28) at self.appendViewElement (/lib/ionic/js/ionic.bundle.js:59900:24) at Object.render (/lib/ionic/js/ionic.bundle.js:57893:41) at Object.init (/lib/ionic/js/ionic.bundle.js:57813:20) at self.render (/lib/ionic/js/ionic.bundle.js:59759:14) at self.register (/lib/ionic/js/ionic.bundle.js:59717:10) at updateView (/lib/ionic/js/ionic.bundle.js:65398:23) at /lib/ionic/js/ionic.bundle.js:65382:9 <ion-nav-view name="side-menu21" class="view-container" nav-view-transition="ios">`

Here is my code: Js

 .controller('WatchController', ['$scope', '$http', '$state', '$stateParams', '$location', '$sce', function ($scope, $http, $state, $stateParams, $sce) {
    $scope.title = 'Air 247';
    $scope.apiusername = '?';
    $scope.apipassword = '?';
    $scope.waid = $stateParams.wId;
$sceDelegateProvider.resourceUrlWhitelist([
  'self',   
  'http://tvstartup.biz/**']);
  $scope.trustSrc = function(src) {
    return $sce.trustAsResourceUrl(src);
  }
$scope.videourl = 'http://tvstartup.biz/mng-channel/vpanel/vod.php?token=c177083f3e6b9c913a691e28ce92f799&id=' + $scope.waid;

}])

HTML

<iframe ng-src="{{ videourl }}" seamless="seamless"  scrolling="no" frameBorder="0" allowfullscreen width="960" height="470" > </iframe>

What I want it to do is play the video that is in the iframe, but I keep getting those errors. I've also tried passing the id into the ng-src, but it did not work and I still got the same errors as the top 2.

来源:https://stackoverflow.com/questions/39669271/angularjs-ionic-error-in-iframe-when-trying-to-play-a-video

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!