我使用AngularJS 1加載與我使用不同iframe的源極的上傳.json文件(見下面我的控制器)的iframe未示出:AngularJS - 從JSON文件加載其SRC當
myApp.controller('iFrames', ['$scope', '$http', function($scope, $http){
console.log("ENTERING LOADING IFRAME");
$http.post('../json/iframes.json').success(function(data){
console.log("LOADING SUCCESSFULL");
$scope.iframes = data;
});
console.log("LEAVING LOADING IFRAME");
}]);
的問題在於我的頁面上沒有顯示iframe,因爲知道json文件已正確加載。
你需要知道,在json文件中的網址都在https中,我認爲這是什麼原因造成這裏的問題。
在HTML我有:
<div class="col-lg-4 col-md-4 col-sm-6 col-xs-6" ng-controller="iFrames">
<div class="panel">
<div class="panel-body">
<h3 class="text-center" style="color:white"><div id="changeStat"><span data-i18n="mainTranslation.user.house.consommation"></span></div></h3>
<div id="statRealTime" ng-repeat="iframe in iframes" >
<iframe ng-src="{{(iframe.src)}}" width="420" height="75" frameborder="0"></iframe>
</div>
<div id="statHistory" style="display: none" ng-repeat="iframe in iframes" >
<iframe ng-src="{{(iframe.srcHist)}}" width="420" height="75" frameborder="0"></iframe>
</div>
</div>
</div>
</div>
我收到一個錯誤是,網址是有點不安全。
"Error: [$interpolate:interr] http://errors.angularjs.org/1.5.0/$interpolate/interr?p0=%7B%7B(iframe.srcHist)%7D%7D&p1=Error%3A%20%5B%24sce%3Ainsecurl%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.5.0%2F%24sce%2Finsecurl%3Fp0%3Dhttps%253A%252F%252F.......
我的文件是在本地,我也試圖把它放在遠處的服務器上,但仍然是同樣的問題。
我希望得到一些幫助...
點擊由該錯誤創建的鏈接...角度錯誤網站將提供一個解釋通貨膨脹。或者使用完整的開發版本的角度來獲得更詳細的錯誤和堆棧跟蹤輸出 – charlietfl