ngClick speed issues


#1

Hey there everyone, I’m running into an issue where the speed of an ngClick trigger is very slow. For instance I’ll tap on

<div ng-click="doSomethingSimple()"></div>

And it’ll take a good 800-1500ms before it responds. This is way to slow for interacting with a user.

What’s interesting though is that this is not consistent. Sometimes when I tap on that div element it will respond very quickly, then a few seconds later, respond very slow.

Anyone else running in this issue? Thanks.


#2

I’ve narrowed this down a wee bit. My div element is sort of a toggle where clicking it adds an element to an array with javascripts push method. Clicking the same div uses javascripts splice method to remove that element from the array.

Clicking the div element responds fairly quickly (most of the time) to the users touch, but clicking it again is very laggy. In my chrome browser on my computer ngClick fires extremely fast, but on my phone it lags. What’s the issue here?


#3

After a bit more playing I’ve noticed the lag starts with the first tap and increasingly gets quicker with each additional click. It’s like angular is lazy at the beginning and then wakes up :smiley:


#4

is the issue still prevalent if the callback fn is only

function() { console.log(‘clicked’); } instead of any real logic


#5

Hi @seanhill!

Could you create a reproduce case?

This plnkr is a good start: http://plnkr.co/edit/79Rzze


#6

Hey @andytjoslin , just messaged you. Hey @nicklovescode I actually put a console.log(“clicked”) at the end of the function. When run in the emulator, it’s displayed in the console after my function is complete, but then it lags until angular updates the view.

FYI, at the end of the function $scope.$$phase is $apply.