Debug slow angular-ui-router state change on Mobile Safari(在 Mobile Safari 上调试缓慢的 angular-ui-router 状态更改)
问题描述
我正在编写一个 Angular 应用程序,使用 angular-ui-router 来管理状态/路由.
I'm writing an angular app, using angular-ui-router to manage states / routing.
在桌面浏览器(Chrome/Safari)上运行良好.但是,在 iPhone 4 上的 IOS 6 上的 Mobile Safari 上(以及在 iPhone 5 上的 IOS 7 上的较小扩展)上,通过 $state.go 更改状态可能需要长达 2 秒的时间.
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.
我使用的是 ngTouch,所以我不认为原生点击事件需要 300 毫秒才能触发.不调用 $state.go 的 ngClick 属性现在似乎几乎可以立即工作.
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 不适用于 ui-sref 指令.我们使用 fastclick.js 来处理点击行为,并移除了 ngTouch.问题是指令会踩到彼此的事件,实际上是不兼容的.你可以通过阅读这两个指令的实现来看到这一点.
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.
这篇关于在 Mobile Safari 上调试缓慢的 angular-ui-router 状态更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 Mobile Safari 上调试缓慢的 angular-ui-router 状态更改
基础教程推荐
- AdMob 广告未在模拟器中显示 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
