Google chrome 如果设置src=";**,则不会调用iframe onload函数。html";在firefox中
如果在firefox中设置src=“**.html”,则不会调用iframe onload函数。删除时,文档在chrome中找不到divGoogle chrome 如果设置src=";**,则不会调用iframe onload函数。html";在firefox中,google-chrome,firefox,iframe,angular-ui-grid,Google Chrome,Firefox,Iframe,Angular Ui Grid,如果在firefox中设置src=“**.html”,则不会调用iframe onload函数。删除时,文档在chrome中找不到div <!doctype html> <html ng-app="app"> <head> <meta charset="utf-8" /> <script type="text/javascript"> function on_load(iframe) { var eleme
<!doctype html>
<html ng-app="app">
<head>
<meta charset="utf-8" />
<script type="text/javascript">
function on_load(iframe) {
var element = document.getElementById('myuigrid');
var scope = angular.element(element).scope();
if (scope != null) {
scope.setViewModel(myuigriddata);
}
}
</script>
</head>
<!-- src="**.html" removed,document.getElementById('myuigrid') returned null; -->
<!-- if not, firefox can't call onload method -->
<body>
<iframe style="display:none" onload="on_load(this)"></iframe>
<div id="myuigrid" ng-if="!refresh" ui-grid="gridOptions">
</div>
</body>
</html>
加载时的功能(iframe){
var元素=document.getElementById('myuigrid');
var scope=angular.element(element.scope();
if(范围!=null){
scope.setViewModel(myuigriddata);
}
}
下面是一个快速解决方案;等待更好的答案var scope=angular.element(document.getElementById('myuigrid')).scope();if(scope==未定义){iframe.src=“…”}if(scope!=null){scope.setViewModel(myuigrid);}