在移动Safari上调试缓慢的角度路由器状态更改 [英] Debug slow angular-ui-router state change on Mobile Safari

查看:153
本文介绍了在移动Safari上调试缓慢的角度路由器状态更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在桌面浏览器(Chrome / Safari)上,这是正常的工作,我正在写一个有角度的应用程序,使用角ui路由器来管理状态/路由。 。然而,在iPhone 4上的iOS 6上的Mobile Safari上(并且在iPhone 5上的IOS 7上更小)通过$ state.go更改状态,可以采取任何长达2秒的时间。



我使用ngTouch,所以我不认为这是本机点击事件触发的300ms。 ngClick属性不调用$ state.go现在似乎工作几乎瞬间。



我如何调试这个来查找花费的时间? p>

解决方案

ngTouch不适用于ui-sref指令。我们使用 fastclick.js 来处理点击行为,并删除ngTouch。问题是指令对彼此的事件发生了冲突,实际上是不兼容的。您可以看到这两个指令的实现。


I'm writing an angular app, using angular-ui-router to manage states / routing.

On desktop browsers (Chrome / Safari) this is working fine. However, on Mobile Safari on IOS 6 on iPhone 4 (and to a lesser extend on IOS 7 on iPhone 5) changing state, via $state.go, can take anything up to 2 seconds.

I'm using ngTouch, so I don't think that it's the 300ms that the native click event takes to fire. ngClick attributes that don't call $state.go now seem to work pretty much instantaneously.

How can I debug this to find where the time is being spent?

解决方案

ngTouch doesn't work with the ui-sref directive. We used fastclick.js to handle the click behavior, and removed ngTouch. The issue is that the directives step on each others events, and are in fact incompatible. You can see this by reading the implementation of both directives.

这篇关于在移动Safari上调试缓慢的角度路由器状态更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆