©
本文檔使用 php中文網手册 發布
Filters are used for formatting data displayed to the user.
The general syntax in templates is as follows:
{{ expression [| filter_name[:parameter_value] ... ] }}
$filter(名称);
参数 | 类型 | 详述 |
---|---|---|
名称 | String | Name of the filter function to retrieve |
Function | the filter function |
<div ng-controller="MainCtrl">
<h3>{{ originalText }}</h3>
<h3>{{ filteredText }}</h3></div>
angular.module('filterExample', []).controller('MainCtrl', Function($scope, $filter) {
$scope.originalText = 'hello';
$scope.filteredText = $filter('uppercase')($scope.originalText);});