-
Notifications
You must be signed in to change notification settings - Fork 722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make angular.$apply optional #299
Comments
@miguelangelmunoz ngInfiniteScroll doesn't call $rootScope.$apply |
Sorry, scope.$apply(scope.infiniteScroll); |
@miguelangelmunoz it already checks to see if we're in a phase: https://github.com/sroze/ngInfiniteScroll/blob/master/src/infinite-scroll.js#L89-L93 |
Hi @graingert, The intention is to have an option to manage when angular digest is executed. This is for performance purposes. Miguel created a brach adding a new parameter where you can set avoiding the explicit call on $apply(). |
@danielkocsan have you considered https://material.angularjs.org/latest/api/directive/mdVirtualRepeat |
Hi @graingert, Not yet, it looks like a thing to consider for our further improvements. Thanks for the tip and also for the quick responses. Currently though, we use this library and we are having performance issues which should be fixed. Do you think we can apply this change? Could be useful for other users as well and doesn't affect the rest as it defaults to the current behaviour. @miguelangelmunoz has added test coverage too. |
@danielkocsan I've not seen anything yet...? |
@graingert you can find the Pull Request in the following link: |
I don't think it's a good idea to expose this sort of interface. I think this should always call $apply(). Also IMHOP ngInfiniteScroll is in permanent feature freeze / maintenance mode and people should be using https://material.angularjs.org/latest/demo/virtualRepeat or waiting for angular/components#823 |
It would make sense to explain why do you think things rather then just saying them. |
This is because |
This is not the same case. |
the loadMore function is passed as a directive callback, all directive callbacks should trigger a digest cycle, eg ngClick |
You are safe if you do that but not efficient. That's why there are multiple performance issues reported with Angular 1.x |
In order to avoid calling scope.$apply(scope.infiniteScroll); every time, let's add the option to handle it with a parameter.
The text was updated successfully, but these errors were encountered: