I have created Angular2 code like this to get the data on button click
<div class="field-panel">
<div>
<span>
<input #newData [(ngModel)]="data.id" type="text" >
<select #newCategory [(ngModel)]="i.index" class="input-bars">
<option *ngFor="let data of field" [value]="data.value">{{data.value}}</option>
</select>
</span>
<button class="btn btn-success (click)="addData(newData.value, newCategory.value)">ADD</button>
</div>
</div>
addData(value, dropValue){
this.Data[index] = value;
}
But when the button is clicked the data on the input field is getting lost in ui. How to keep it when the button is clicked and display on the ui as well??
selectdropdown as well, I have edited the codethis.Data[index] = value;this to store the data to array