First, let’s introduce the $filter service:
1. $filter is a dedicated service used for data formatting;
2. AngularJS has built-in currency, date, filter, json, limitTo, lowercase, uppercase, number, orderBy These 8 filters;
3. Filters can be nested and separated by pipe symbols "|" (a bit like Linux);
4. Filters can pass parameters;
5. Users can customize filters.
Introducing the built-in filters:
currency: used to format currency, such as automatically adding "$" or "¥" before the value.
date: Format date, it provides rich date formats.
json: Complete json formatting.
number: Such as converting to two decimal places, etc.
orderBy: Sort. Simple use of
filter:
{{ 1304375948024 | date }} {{ 1304375948024 | date:"MM/dd/yyyy h:mma" }} {{ 1304375948024 | date:"yyyy-MM-dd hh:mm:ss" }} {{ 30 | currency }}
Output:
May 3, 2011
05/03/2011 6:39AM
2011-05-03 06:39:08
$30.00
Customized filter:
eg:
var myModule = angular.module('myModule',[]); myModule.filter('myFilter',function(){ return function(item){ return 'Hi,'+item; } });
Use: {{ 'JennyLin' | myFilter }}

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.
