在 Mobile Safari 上调试缓慢的 angular-ui-router 状态更改 [英] Debug slow angular-ui-router state change on Mobile Safari

查看:25
本文介绍了在 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 状态更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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