【发布时间】:2016-07-04 23:11:27
【问题描述】:
如何使用 AngularJS 获取 iframe 元素的引用?
<div>
<iframe id="myframe" ...>
</div>
mycontroller.$inject = ['$document'];
function mycontroller ($document) {
console.log($document.getElementById("myframe")); //always null
}
我可以看到 iframe,但参考查找总是打印 null。为什么?
【问题讨论】:
-
你为什么要使用 Angular?从简单的 jquery 调用它:)
标签: javascript html angularjs iframe