You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
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.
The text was updated successfully, but these errors were encountered:
Currently you use controllers on directives to expose functionality. Then other directives use those controllers by supplying
require
and getting the controllers in thelink
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 fromlink
tocontroller
.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.
The text was updated successfully, but these errors were encountered: