Filters can be added to expressions and directives using a pipe character (|).
AngularJS filters syntax
AngularJS filters can be used to transform data:
| Filter | Description |
| currency | Format numbers into currency format. |
| filter | Selects a subset from array items. |
| lowercase | Format the string to lowercase. |
| orderBy | Order an array based on an expression. |
| uppercase | Format string to uppercase. |
AngularJS filters example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://cdn.bootcss.com/angular.js/1.4.6/angular.min.js"></script>
</head>
<body>
<div ng-app="myApp" ng-controller="personCtrl">
<p>姓名为 {{ lastName | uppercase }}</p>
</div>
<script>
angular.module('myApp', []).controller('personCtrl', function($scope) {
$scope.firstName = "John",
$scope.lastName = "Doe",
$scope.fullName = function() {
return $scope.firstName + " " + $scope.lastName;
}
});
</script>
</body>
</html>Run instance »
Click the "Run instance" button to view the online instance

