Book Image

DART Cookbook

By : Ivo Balbaert
Book Image

DART Cookbook

By: Ivo Balbaert

Overview of this book

Table of Contents (18 chapters)
Dart Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using formatters as filters


Formatters are helper tools to view your data differently from how they are stored in the model. Angular has built-in formatters, for example, Date to format date-times, Currency to format money data, and LimitTo to limit the view to a certain number of results. The Filter class displays items based on whether they satisfy the criteria set up in the filter. Sorting works through an orderBy attribute in ng-repeat. In this recipe, we will show you how to use filters to make different views on your data possible. You can follow along with the code in the project angular_formatter.

How to do it...

The job listing is now preceded by an input field; when you start typing the job type, the list of only those jobs that start with these letters are shown. The checkboxes allow you to filter on company, and the type of job is shown in uppercase in the job details section, as shown in the following screenshot:

Using formatters to limit the view

Perform the following steps to...