角度2:单击对象时推入阵列

时间:2017-08-31 08:14:07

标签: arrays angular events mouseevent push

当我单击一行对象时,我希望将其推入selectedProducts数组。

我的打字稿中有这个

selectedProducts: Product[] = [];

select(prod) {
    this.selectedProducts.push(prod);
    console.log(this.selectedProducts);   
}

但它只获取我在用户侧点击的第一个对象

以下是我的HTML

<div class="list-content fluid">
    <div class="products-cards" *ngFor="let product of dataSource['docs']">
        <app-product-card [product]="product" (click)="select(product)"></app-product-card>
    </div>
</div>

1 个答案:

答案 0 :(得分:1)

我建议试试这个:

create or replace PACKAGE BODY MIX_WEBSEARCH 
AS

    PROCEDURE general_get_item(
    p_item_no   IN item_t.item_no%TYPE,
    p_item_type IN item_t.item_type%TYPE,
    p_item OUT rec_general_item)
IS
BEGIN
  OPEN p_item FOR SELECT it.item_no, it.item_type, it.item_state, it.item_name, it.prodname_no , it.prod_name, it.prodname_no2, it.prod_name2, it.prodtype_no, it.prodtype_name, it.designer_no, it.designer_name, it.req_assembly, it.unit_name, it.valid_designer, it.sale_start_date, it.sale_end_date, it.short_material_text, it.imeas_ref_imp, it.imeas_ref_met, it.valid_design_text, it.pe_no, it.hfb_no, it.hfb_name, it.pra_no, it.pra_name, it.pa_no, it.pa_name, it.rec_sales_price, it.currency_code, icst.item_no as base_item_no, ict.comclass_name 
  FROM item_t it, item_cty_spec_t icst, 
  (SELECT item_no, item_type, comclass_name FROM item_comclass_t 
  WHERE valid_from < SYSDATE AND valid_to >= SYSDATE) ict
  WHERE it.item_no = icst.item_no_cty_spec (+) AND it.item_type = icst.item_type_cty_spec (+)  
  AND it.item_no = ict.item_no (+) AND it.item_type = ict.item_type (+)
  AND it.item_no = p_item_no 
  AND it.item_type = p_item_type;
END general_get_item;

END;