• Use in HTML files and in JS files
$scope. Form_time = $filter (' Date ') ($scope. Time, ' Yyyy-mm-dd HH:mm:ss ');
<p>{{time | date: ' YYYY-MM-DD HH:mm:ss '}}</p>
• Internal filters and custom filters
. Filter (' My_data_format ', [function () {return
function (data,str,sss) {
console.log (' Data: ', data, ' str: ', STR, ' SSS: ', arguments[2]);
}
];
VAR1 is the first parameter data, 123 is the second parameter str, this is the third parameter
<p>{{var1 | my_data_format:123: ' This '}}</p>
// Processing of incoming data
. Filter (' My_data_format ', [function () {return
function (data,str) {
var arr=[];
Angular.foreach (data, function (one_list) {
if (one_list.status = str) {
arr.push (one_list);
}
});
Return arr
}
]);
Filters can be used in bound values or in ng-if= "(Lists | My_data_format: ' 2 '). Length>0", and Ng-show, and so on; similar expressions. As a judgment statement
<p ng-repeat = "list in lists" > name: {{list.name}}, number {{lists | my_data_format: ' 2 ') .length}}</p>
This in-depth understanding of the ANGULARJS filter is a small series to share all the content, hope to give you a reference, but also hope that we support the cloud-dwelling community.