JSFiddle - React, Tailwind, and code Playground

by Stepan Kasyanenko

HTML

<div ng-app ng-controller="TestController">
  <div ng-repeat="item in list">
    <label>Input {{$index+1}}:</label>
    <input ng-model="item.value" type="text" />
    <button ng-click="reset($index)">
      x
    </button>
  </div>
  {{list}}
  <br>
</div>

JavaScript

function TestController($scope) {

  $scope.list = [{
    value: 'value 1'
  }, {
    value: 'value 2'
  }, {
    value: 'value 3'
  }];
  var orgiinalList = [];
  angular.forEach($scope.list, function(item) {
    orgiinalList.push(angular.copy(item));
  });

  $scope.reset = function(index) {
    $scope.list[index] = angular.copy(orgiinalList[index]);
  };
}