Book Image

AngularJS Web application development Cookbook

By : Matthew Frisbie
Book Image

AngularJS Web application development Cookbook

By: Matthew Frisbie

Overview of this book

Packed with easy-to-follow recipes, this practical guide will show you how to unleash the full might of the AngularJS framework. Skip straight to practical solutions and quick, functional answers to your problems without hand-holding or slogging through the basics. Avoid antipatterns and pitfalls, and squeeze the maximum amount out of the most powerful parts of the framework, from creating promise-driven applications to building an extensible event bus. Throughout, take advantage of a clear problem-solving approach that offers code samples and explanations of components you should be using in your production applications.
Table of Contents (17 chapters)
AngularJS Web Application Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Trimming your watch list with lazy binding


A continuing gripe with AngularJS as a framework is targeted at the perceived inefficiencies of its data binding facilities. While it is true that it can be easy to fall into bad performance traps, a developer who understands what is going on under the hood and is able to make decisions accordingly can wield AngularJS against any architectural challenge.

Bind once is one of the more heralded introductions in the AngularJS 1.3 release. It offers one-time data binding, allowing the developer to reason about the necessity of real-time data being interpolated in the template and elect to opt out of that data binding in order to improve the overall performance of the application.

How to do it…

One-time data binding can be signaled inside the parsed expression at the time of compilation by prepending the expression with ::, as demonstrated here:

<span ng-show="user.isAuthenticated">{{ ::user.name }}</span>

This will maintain normal data binding...