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.

Isolate scope properties not bound to controller #15619

Closed
@thany

Description

@thany

Do you want to request a feature or report a bug?
Bug.

What is the current behavior?
The properties set in an isolated scope object hash for a directive, are not bound to the controller, even when using bindToControler: true. They only appear to be bound to the template.

Here's a demo: https://jsfiddle.net/z9pgasbt/
It will console.log undefined for a value called name that has been bound via isolate scope to the controller. All documentation and tutorials point to it should work this way.

What is the expected behavior?
The above example should print "Foobar" instead of undefined. Technically speaking, the properties defined in an isolate scope should be bound to the controller, and should be usable as such in the controller - not just in the template.

What is the motivation / use case for changing the behavior?
Using bindToController with controllerAs as it appears to be intended.

Which versions of Angular, and which browser / OS are affected by this issue? Did this work in previous versions of Angular? Please also test with the latest stable and snapshot (https://code.angularjs.org/snapshot/) versions.
Firefox 50, AngularJS 1.6.1.
Tested with snapshot version - problem persists.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions