查找从ember中的条件语句返回的记录数

时间:2017-03-28 14:40:55

标签: ember.js

我有一个除非条件,我想找出满足此条件的记录数,除非条件。

可以在ember中执行此操作吗?

编辑:

{{#each model.orderParts as |newCart|}} 

  {{#unless newCart.isGeneric}}
    <div class="card-wrapper col-lg-12 col-md-12">
<div class="col-lg-2 col-md-2">
    <div class="order-id">{{newCart.partNumber}}</div>
    {{#if (gte newCart.promiseQty newCart.quantity)}}
    <div class="order-status delivered">{{env.APP.StockAvailable}}</div>
    {{else}} {{#if (gt newCart.promiseQty '0'(and (lt newCart.promiseQty newCart.quantity)))}}
    <div class="order-status delivered">{{env.APP.LowInStock}}</div>
    {{else}} {{#if (eq newCart.promiseQty '0')}}
    <div class="order-status delivered">{{env.APP.OutofStock}}</div>
    {{/if}} {{/if}} {{/if}}
</div>
<div class="col-lg-3 col-md-3">
    <div class="item-header">Delivery Date</div>
    <div class="item-data">{{newCart.deliveryDate}}</div>
</div>
<div class="col-lg-2 col-md-2">
    <div class="item-header">Required Qty.</div>
    <div class="item-data">
        {{increse-required-quantity incresedQuantity=newCart.quantity}}
    </div>
</div>
<div class="col-lg-2 col-md-2">
    <div class="item-header">Unit Price</div>
    <div class="item-data">{{newCart.unitPrice}}</div>
</div>
<div class="col-lg-2 col-md-2">
    <div class="item-header">Total Price</div>
    <div class="item-data">{{newCart.partTotalPrice}}</div>
</div>
{{/unless}}  {{/each}}

我想要的是找出满足这种条件的记录数

1 个答案:

答案 0 :(得分:1)

genericFalseCount: Ember.computed.filterBy('model.orderParts','isGeneric',false)

以上计算属性将为您提供计数。