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.

Expose required controllers to a directive's controller #13041

Closed
@abyx

Description

@abyx

Currently you use controllers on directives to expose functionality. Then other directives use those controllers by supplying require and getting the controllers in the link function.

This feels asymmetric and a more natural way would be to allow the injection of required controllers to the directive's controller as well. That would mean that for a lot of use cases would could simply write directives with just the controller function and no need to pass it awkwardly from link to controller.

I was thinking about something like providing a $requires injectable for directive controllers that is basically an object, like $routeParams, from controller name to controller object.

If that sounds reasonable I'll work on a pull request.

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