使用 angularjs 在流星范围内自定义过滤

Custom filtering in range in meteor with angularjs

我在按范围过滤时遇到了很大的问题。 我需要按价格过滤产品。抱歉弄得一团糟

HTML:

<input type="number" ng-model="cena.minAmount">
<input type="number" ng-model="cena.maxAmount">

<div ng-repeat="przedmiot in przedmioty | filterPrice">
    <p>
      {{przedmiot.name}}
    </p>
    <p>
      {{przedmiot.cena | currency}}
    </p>
  </div>
</div>

JS

this.amountRange = function(input, cena) {
  var filteredAmount = [];
  angular.forEach(input, function(przedmiot){
    if(amount && (przedmiot.cena >= cena.minAmount && przedmiot.cena        <=  cena.maxAmount))
    filteredAmount.push(item);
  });
  return filteredAmount.length>0 ? filteredAmount : input
  }`

AngularJS 有货币过滤器,你可以多看看这些例子:

AngularJS www.w3schools.com currency Filter

AngularJS docs currency Filter

您必须创建自定义过滤器:

Building custom filters