有没有办法在AngularJS指令中调用orientationchange事件?Angular中的window orientationchange事件
我目前与angular-masonry一起工作,我正在尝试在移动设备的方向更改时更新/刷新 砌体。
我发现这一点,但我不知道如何与内部角
window.addEventListener("orientationchange", function() {
// Announce the new orientation number
console.log(window.orientation);
}, false);
Thx,比我想象的要容易! – tdhulster
Ofc不要忘记在控制器中注入$ window! – amdev
但有些东西很奇怪,'orientationchange'在屏幕宽度改变之前就是火了......所以如果我在'orientationchange'之后执行一些东西,并试图获得新的宽度,它不起作用,请给我旧的。 – amdev