是 Angular1.x 指令编译阶段的元素.ready 相当于 JavaScript 的 onload for a e

is angular1.x directive compile stage's element.ready the equivalent of javascript's onload for an elment?

本文关键字:JavaScript 相当于 onload for ready 元素 指令 编译 Angular1      更新时间:2023-09-26

我想专门使用元素。onload(function(){})元素在compilepost步骤中完成加载时。但是我看到编译内部的elem包括onload作为null所以基本上onload角度元素不存在。我找到了.ready附加到元素函数,但这是等效的吗?

我的场景:基本上,我有一个包含谷歌广告的指令,我用ng-transclude将它包含在另一个指令中,将谷歌广告指令包含在其中。

我想看看是否有办法确定广告完全加载的确切时刻,我认为 dom 的onload是一个不错的选择,但我在编译阶段的角度指令的 elem 参数中找不到等效的,据说应该是应该呈现所有 dom 的阶段?

这是

要走的路:

var $scope.init = function(){
 //your code`enter code here`
}