cannot load file in iframe getting error: Can't interpol
cannot load file in iframe getting error: Can't interpolate: {{file}}
我想在iFrame中加载一个文件但我得到一个错误,如
angular.js:13642 Error: [$interpolate:interr] Can't interpolate: {{file}}
Error: [$sce:insecurl] Blocked loading resource from url not allowed by $sceDelegate policy. URL: http://localhost:4000/api/uploads/574ed76718153dac202679b9_resume.pdf
为此,我找到了在控制器
中使用以下代码的解决方案$scope.trustSrc = function(src) {
return $sce.trustAsResourceUrl(src);
}
但是我现在面临的问题是它像一个不终止的循环一样继续执行,文件也没有被加载。
这是我的HTML<div ng-class="{'col-xs-6': myVar=='something'}">
<div class="panel panel-default panel-height" ng-repeat="candidateInfo in aCandidateDetails track by $index" ng-click="fnInterviewView(candidateInfo.name)">
<div class="panel-heading header-background">
<div stop-watch time="xyz" name="candidateInfo.name" time-of-interview="candidateInfo.doi" class="stop-watch"></div>
<div class="row">
<div class="col-xs-2"><a style="cursor:pointer" class="pull-right">{{candidateInfo.name}}</a></div>
<div class="col-xs-offset-9"><a style="cursor:pointer" ng-click="fnVar(candidateInfo.name,candidateInfo.filepath);$event.stopPropagation()" data-toggle="collapse" data-target="{{'#'+toggle}}">{{candidateInfo.name}} resume</a></div>
</div>
</div>
</div>
angular.module('hrPortalApp')
.controller('candidateInterviewCtrl', function($scope, $state, $sce, getCandidateInterviewListService) {
getCandidateInterviewListService.fnGetCandidateDetails(name).then(function(response) {
$scope.aCandidateDetails = response;
console.log(response);
$scope.toggle = "accor"
});
$scope.fnVar = function(name, filepath) {
$scope.file = "http://localhost:4000/" + filepath;
$scope.checkVar = !$scope.checkVar;
if ($scope.checkVar) {
$scope.myVar = "something";
} else {
$scope.myVar = false;
}
};
$scope.fnInterviewView = function(name) {
$state.go('main.Topics', {
"candidateDetails": $scope.aCandidateDetails,
"name": name
})
};
$scope.trustSrc = function(src) {
return $sce.trustAsResourceUrl(src);
}
});
我不知道哪里出了问题
如有任何帮助,不胜感激
看起来您正在重路由到'main '。当它传播到div -click函数时,点击第一个链接的主题视图。
这可能有助于在AngularJS中使用iframe
相关文章:
- 角度ng变化或ng点击选择can'不起作用
- 自定义运行时Can'在谷歌应用引擎中看不到我的自定义日志
- Can用户'MediaWiki上的自定义JavaScript调用Lua模块
- NodeJS错误-Can't在发送标头后设置标头
- Javascript:Can't使用getElementById获取元素
- 错误:Can't在从forEach循环发送标头后设置标头
- Chrome扩展:Can't从chrome.local变量中检索值
- Express 4错误:Can't在发送标头后设置标头
- sqlite查询返回错误-can'我不知道为什么
- 如何从ajax php中获取值(can'tget)
- NodeJS未处理的拒绝错误:Can't在发送标头后设置标头
- Podio问题:Can't将字符串转换为数字
- PHP:Can't填充TinyMCE文本区域
- Can't get setters/getters to work
- Can't get the tail to wag (animate) in three.js?
- 有CSS问题:can't将文本放置在选择框的右侧
- 摩卡+柴+jsdom Can't加载自定义模块目录
- How can I get and replace this in javascript ( jquery?
- bootstrap字体真棒can'不起作用[使用cdn]
- cannot load file in iframe getting error: Can't interpol