2016-08-11 3 views
0

내 웹 페이지에 iframe을 ng-src="localhost/test/public/getreportsdata/1"으로 만들려고합니다. 나는 trust 소스 함수 $sce.trustAsResouceUrl을 사용했다. 그것은 iframe에서 서비스의 결과를 여는 것이다.angularJS ng-src with trustAsResourceURL

나는 그것이 나에게주는 내 바탕 화면에 지금, 일을 내 노트북에 그것을 테스트 :

내 HTML은 iframe 정의되지 않은

의 특성 'trustAsResourceUrl'읽을 수 없습니다 :

<iframe width="800" height="800" ng-src="{{trustSrc(reportbydateresource.src)}}"></iframe> 

내 js 코드 :

angular.module('backOfficeApp') 
.controller('CheckReportsCtrl', CheckReportsCtrl); 
CheckReportsCtrl.$inject=['$scope','$http','$filter'] ; 
function CheckReportsCtrl($scope,$http,$filter,$sce){ 
$scope.trustSrc = function (src){ 
return $sce.trustAsResourceUrl9src); }; 
$scope.reportbydateresouce={src:"localhost/test/public/getreportsdata/1"} 

아이디어가 있으십니까? 내가 해결 버전 1.5.8 및 문제에서 angularjs.js을 제거 angular.min.js의 angularjs.js 및 angular.js 포함 된 업체

.controller('CheckReportsCtrl', CheckReportsCtrl); 
CheckReportsCtrl.$inject=['$scope','$http','$filter','$sce'] ; 

2와

+0

주의 : $ sce 서비스를 삽입하는 것을 잊었습니다. CheckReportsCtrl. $ inject = [ '$ scope', '$ http', '$ filter']; -> CheckReportsCtrl. $ inject = [ '$ scope', '$ http', '$ filter', '$ sce']; – Silvinus

+0

$ sce는 여기에 주입하는 privider가 아닙니다. 알 수없는 privider : $ sce를 주입하려고 할 때 $ sceProvider –

+0

$ sce를 사용하려면 주입해야합니다. "공급자를 알 수 없음 ..."은 각도 초기화에 실패했음을 의미합니다 (https://plnkr.co/edit/bczfuhKEnyaef71q2S0R?p=preview) – Silvinus

답변

0

1 주입 $의 SCE.