当我单击角度6中的动态添加行时如何获取先前的数据?

时间:2019-01-23 05:36:14

标签: typescript angular6

  addFieldValue() {
       this.newarray= this.fieldArray.push(this.newAttribute)
       console.log(this.newarray);
        this.newAttribute = {};
    }
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.10/angular.min.js"></script>
  <td>
              <input [(ngModel)]="field.SourceIP" class="form-control" type="text" name="{{field.SourceIP}}" />
          </td>
          <button mat-button  (click)="addFieldValue()">Add More Rule
        <i class="material-icons custom">add</i>
</button>

 addFieldValue() {
       this.newarray= this.fieldArray.push(this.newAttribute)
       console.log(this.newarray);
        this.newAttribute = {};
    }

    deleteFieldValue(index: number) {
        this.fieldArray.splice(index, 1);
    }

当我在表中添加动态行时,我看不到该行的先前数据。我正在使用Angular 6?

点击添加后,我在此处输入数据添加行后,我丢失了以前的数据

enter image description here

0 个答案:

没有答案