Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Feature request: allow ngEvents to opt out of $apply #9280

Open
@chrisirhc

Description

@chrisirhc

Right now, assigning ngEvent directives such as ngClick or ngMouseenter on an element causes it to always call apply when those events are triggered. This can be a huge performance issue if you have ngMousemove on a large element in a large application. It'll trigger $apply continuously which makes it almost unusable. There are also cases where a developer wants to listen to some events (and only trigger certain expressions) only under certain conditions instead of all the time.

I suggest a function that can opt out of $apply which could be useful for developers who want to trigger $apply only when it's needed.

This could come in the form of a local function such as $shouldApply, where the user can call $shouldApply(false) in their expression. Or it can simply follow the preventDefault convention by having a $preventApply() function. I don't think it should use the event.preventDefault to determine not to $apply though, since that maybe used for other purposes by the developer.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions