-
Notifications
You must be signed in to change notification settings - Fork 27.4k
feat(rootScope): allow $apply expressions to prevent unnecessary digest #8301
Conversation
Thanks for the PR! Please check the items below to help us merge this faster. See the contributing docs for more information.
If you need to make changes to your pull request, you can update the commit with Thanks again for your help! |
This means that |
02dc2aa
to
fd2d6c0
Compare
cad9560
to
f294244
Compare
e8dc429
to
e83fab9
Compare
4dd5a20
to
998c61c
Compare
Any thoughts about this one? I really like it and I even thought about adding another option |
CLAs look good, thanks! |
Added support also for Closes #7298 |
The main issue with this PR is that |
I agree that the purpose of this change is only so that people will not have to duplicate directives, but I think it is a common enough use case that we can provide them the tools they need and not force them to duplicate code. |
Adding duplicate code/multiple ways to do the same thing in a critical component as it is
|
Merging this would make the migration to Angular 2 harder. I am going to close this. In case I am missing something, feel free to reopen this issue |
I would have envisioned this with a lot less simpler interface. Just adding some options similar to ng-model-options to the directives themselves: The above gives more power over the mechanics under the hood, but that is fine too as long as it fixes the problem.
@lgalfaso : Excuse me to say, but I find it very hard to understand your mode of thinking. These are problems that the community are facing TODAY and you are closing a PR on a project which will probably not be maintained in 2 years and you are pointing out to a FUTURE AngularJS 2.0 project in which NOBODY could implement anything as of today. How is this helping? What am I missing here? |
@dragosrususv that wouldn't work with multiple event handler when only some should skip the digest |
@realityking - touche. ng-mouse-enter-options? :) UPDATE: or maybe ng-options="{mouseEnter: {runApply: false}}" --- but that's like entering in a json programmers world. |
@dragosrususv I understand that this might be frustrating, but not everything belongs to the core. In this specific case, if you think that there is a big need for directives that would handle events without triggering |
@lgalfaso : normal directives trigger a $digest/refresh on the whole application instead of just the current $scoping area. PERF wise, that's a disaster. And AngularJS has the right tools to fix this, even if backward compatibility is kept. Still, I do agree that people who actually have this problem (or find the root cause of it!) would fall into the 2% category and it should only be added in framework as an option at most. I'll think about adding a module with such light directives, but I would prefer for people to have this by default instead of adding another bower dep. |
@dragosrususv I understand this may be frustrating, but there are two camps here:
Given that it is a lot easier to just add another library than to selectively remove chunks to save bytes, is that before something is added, we are forced to think several times
|
This allows, for example to prevent unnecessary digest in ngClick handler function in case the handler does not have any immediate side effects.
Closes #8286