O'Reilly logo

Mastering AngularJS Directives by Josh Kurz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Collaborating with controllers

Normal controllers that are used in AngularJS applications hold business logic and drive data model manipulation. There are slight differences between application controllers and directive controllers. Directive controllers are more like service objects. They are singletons and can be shared between directives of the same element or children of the instantiated controller.

To request a controller, a directive needs to have a specific definition object parameter, called require set. The require value defines which directive or directives should inject their controller instances into the link function requesting them. To require another directive's controller, the requiring directive must be declared on the same element ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required