Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debug slow angular-ui-router state change on Mobile Safari

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?

like image 676
Michal Charemza Avatar asked Oct 09 '13 14:10

Michal Charemza


1 Answers

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.

like image 186
Preston Marshall Avatar answered Oct 27 '22 04:10

Preston Marshall