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

Less bindings yield faster results

The amount of bindings created on a single scope is a major source of failure for the overall responsiveness of an AngularJS application. Directives can help fix this by only setting up watchers when necessary. The following are the two scenarios that require some type of data binding:

  • Template needs to be initially interpolated with data and watched for changes
  • Template just needs its initial value and will never be updated

Interpolation is AngularJS's process of taking data from the scope objects and interjecting it into a template by evaluating a template string onto a scope's matching data set.

To accomplish one-time binding expressions in pre 1.3 branches, there are multiple workarounds. The advantages of setting ...

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