Mastering Web Application

(Rick Simeone) #1

Displaying and Formatting Data


Summary


This chapter walked us through a set of patterns used to display data contained in
the model.


We started by quickly covering directive's naming conventions and then moved to
the overview of built-in AngularJS directives. The ng-repeat got special attention as
it is the very powerful and one of the most frequently used directives.


While the DOM-based, declarative template, on which AngularJS is based, works
perfectly most of the time, there are some corner cases where we hit the limits of this
approach. It is important to recognize those situations and be prepared to slightly
change target markup when necessary.


Filters offer a very convenient syntax for UI-specific model formatting. We saw
that AngularJS provides several useful filters by default, but when a specific need
arises it is very easy to create a custom filter. Filtering functions shouldn't be
abused and we had a careful look into scenarios where an alternative constructs
should be considered.


Directives, filters and display patterns covered in this chapter focused on data display.
But before data can be displayed users need to be able to enter them using variety
of input elements. The next chapter dives into AngularJS-way of dealing with form
elements and data input problematic.

Free download pdf