angularjs not always triggering on iOS

1,145 views
Skip to first unread message

Marcelo Barbudas

unread,
May 18, 2013, 12:27:30 AM5/18/13
to ang...@googlegroups.com
Hi.

I'm using angularjs to build a mobile HTML5 app. Everything works fine on the desktop. However as I started the testing on my iOS device I noticed that randomly it is not triggering events:

Some examples:
* I had to tap a button two times for it to take effect.
* It would not update a {{var}} in the partial after a redirect.

The issues were fixed by adding $scope.$apply() after certain events. But I'm guessing this is not the right approach and it's a bug, right?

This is happening on iOS 5.1 on an iPhone 5 on both Chrome and Safari.

Thanks!
M.


Andy Joslin

unread,
May 18, 2013, 7:37:30 AM5/18/13
to ang...@googlegroups.com
I haven't had any problems with this, can you post your code?

Marcelo Barbudas

unread,
May 18, 2013, 9:14:38 PM5/18/13
to ang...@googlegroups.com
I'm going to try to extract/reproduce it in a simple use case.

Did you ever notice delays from when you tap a button to when something actually happens? Like 0.5s but noticeable?

-M.

Andy Joslin

unread,
May 18, 2013, 9:49:17 PM5/18/13
to ang...@googlegroups.com
Yeah, that's a typical problem on all mobile devices.  They wait 0.3s to see if you're going to double tap to zoom before firing a click.

Angular has an ngMobile module which overrides this: http://code.angularjs.org/1.1.4/angular-mobile.js

Include the script after angular in your html, ngMobile as a dependency in your app module: angular.module('myApp', ['ngMobile']);

ngMobile will make `ngClick` events instant on mobile devices.
Reply all
Reply to author
Forward
0 new messages