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.

Make ngClick only $apply when it doesn't return a promise #8286

Open
@pocesar

Description

@pocesar

ngClick should not ignore the return value of the underlaying function. Check if it's a promise, then don't call an unnecessary $scope.$apply, since it will be resolved and applied when $q resolves.

My case: I use a third party promise library bluebird, and do a lot of UI display calculations (prices and discounts) before displaying on the UI. Currently there's a flicker on the UI because the model is emptied (while the ngClick happened) and recalculated through the bluebird promise, that is wrapped using $q.when (that also calls a second $apply when it's resolved), since it's called on the next cycle.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions