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.

Names used by Object.prototype properties cannot be defined as isolate scope properties #9343

Closed
@jrencz

Description

@jrencz

I run into an issue after defining a directive like this:

angular
    .module('foo', [])
    .directive('foo', function () {
        return {
            scope: {
                watch: '@',
            },
        };
    });

The top of the trace was:

Error: listeners.push is not a function
$CompileProvider/this.$get</Attributes.prototype.$observe@http://0.0.0.0:8505/vendor/forks/angular-1.3.0-rc.3-fork/angular/angular.js:6216:9

After I changed the name of the scope attribute into something else (like check) the issue was gone.

While researching the issue my teammate run into #8068 there the problem with watch as a get parameter was described and fixed.

I did check Firefox-only Object.prototype properties:

  • toSource
  • watch
  • unwatch

and they all make Firefox break, but not Chrome.

I checked some other Object.prototype properties:

  • valueOf
  • toString

those break in both Firefox and Chrome.

Changing the binding policy from @ to = does not cause an error.
Changing the binding policy from @ to & does not cause an error.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions