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.

bindToController should work without controllerAs #15088

Closed
@thorn0

Description

@thorn0

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

bug

What is the current behavior?

If I create a directive with bindToController and without controllerAs, I get $compile:noident: Controller identifier is required.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar (template: http://plnkr.co/edit/tpl:yBpEi4).

http://plnkr.co/edit/lhg3NJABx2DQWnF56rzg

What is the expected behavior?

controllerAs shouldn't be required. If the directive doesn't create a scope, adding controllerAs to it will pollute the outer scope.

What is the motivation / use case for changing the behavior?

Use case: directives that have controller bindings, but have neither a template nor an own scope. What do they need controllerAs for?

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.

1.5.8

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions