iFrame 上的 Angular、onLoad 函数 [英] Angular, onLoad function on an iFrame
本文介绍了iFrame 上的 Angular、onLoad 函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我让这个 iframe 使用基本的 JavaScript:
I have this iframe working with basic JavaScript:
<iframe id="upload_iframe" name="upload_iframe" onLoad="uploadDone();"></iframe>
当 iframe 的内容被加载时触发方法 uploadDone();
.
Which triggers the method uploadDone();
when the content of the iframe has been loaded.
我如何在 Angular 中做同样的事情?.我想在 iframe 加载时调用控制器上的函数,但到目前为止我还没有看到 ng-onload
.
How do I do the same thing in Angular?. I want to call a function on the controller when the iframe loads, but I haven't seen a ng-onload
so far.
推荐答案
尝试将控制器内的函数定义为:
try defining the function within controller as:
window.uploadDone=function(){
/* have access to $scope here*/
}
这篇关于iFrame 上的 Angular、onLoad 函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文