更新时间:2023-11-26 20:22:34
的货币
过滤器适用于单个值。如果你想应用到阵列的过滤器,你需要添加你自己的,如:
The currency
filter applies to a single value. If you want a filter that applies to an array, you need to add your own, such as:
angular.module('yourModule')
.filter('currenyArray', function($filter) {
return function(input, uppercase) {
input = input || [];
var out = [];
for (var i = 0; i < input.length; i++) {
out.push($filter('currency')(input[i]))
}
return out;
};
})
然而,这会返回一个数组。如果你想要写的数组,你需要适应的函数来计算字符串而不是一个数组。
However this will return an array. If you do want to write the array, you need to adapt the function to compute a string instead of an array.