It’s quite easy to find advice on Directives Talking to
Controllers (tell the directive what
function to call) and Directive to Directive
Communication (one requires a
controller defined in the other)*. Controller to Controller
communication is usually via
Many directives expose state via the scope to elements defined further down the
But I’ve yet to see any advice on exposing state from a directive to the rest
of the world.
The approach I took in
angular-virtual-scroll was to use the
ng-model attribute (if present) to point to a model that will hold all important state variables. See here if you’re interested. I made the dangerous assumption that nobody would try to alter the state - surely they wouldn’t.