
DART Cookbook
By :

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
.
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...
Change the font size
Change margin width
Change background colour