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

$watch override makes one-time bindings in expressions to never clear the associated watch #109

Closed
@raulmt

Description

@raulmt

This function wrapping done to measure the watchExpression call's performance (https://github.com/angular/angular-hint/blob/master/src/modules/scopes.js#L110-L120) makes one-time binding expressions and also literal string expressions to keep the watcher on scope and executing it forever.

I think the problem is the wrapping function doesn't inherit properties of the original function. One of the missing properties I think causes this wrong behaviour is $$watchDelegate which, in case of one-time bindings and literal string bindings functions has the logic to remove the watch after the first stable call.

The original $watch function checks wether watchExpression function has a $$watchDelegate and calls it if it does. And after adding this file (angular-hint), those wrapped watchExpression functions will never have a $$watchDelegate so the watch will not be removed.

I had this issue while using angular Batarang (Angular's Chrome extension). I noticed that while having Batarang active, adding :: to bracket expressions didn't make me lower the watchers count.

I'm using latest Batarang version (0.8.6) which includes angular-hint 0.3.4.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions