[Fixed] How to push multiple objects in array angular 8


I have form which contain two text field and button.

I want when i enter values in form and click on save button, it will display inside the table.


    const conditionObj = {};    
    const conditionArr = [];
    const formData = this.aValues.vForm.value;
    if(formData.parameter_value.length > 0 && formData.label_value.length > 0) {
      conditionObj['parameter_value'] = formData.parameter_value;
      conditionObj['label_value'] = formData.label_value;

you are reinitializing const conditionArr = [] every time (on each click). declare conditionArr as global.

Leave a Reply

(*) Required, Your email will not be published