Chapter 13AngularJS Filters

Sometimes data stored in a web app is in a format that's different from what we want to show to the users. For example, you may store two-digit country codes in lowercase in your database, but wish to display those country codes on a web page in uppercase. This is where AngularJS filters come in. Filters, as the name suggests, help to filter or format the data to be displayed to the users.

Most commonly, filters are applied to data binding expressions in the template. But they can also be used inside controllers, services, and directives. This chapter covers filters in AngularJS. Once you have the basics covered, we'll see how to implement and unit test some simple filters in our demo app.

Filter Basics

The most common ...

Get AngularJS: Novice to Ninja now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.