var myApp = angular.module('myApp', []);
myApp.controller('myCtrl',myCtrl);
function myCtrl($scope) {
$scope.data = [{
text: 'Lorem ipsum dolor sit amet',
text2: 'consectetur adipiscing elit'
}, {
text: ' Nullam eu molestie mi',
text2: 'Proin eu congue nisi.'
}];
$scope.origData = $scope.data;
$scope.reset = function () {
$scope.data = $scope.origData;
};
}
//Recommendations:
/*
*/
<div ng-controller="myCtrl">
<p>Modify the text in the inputs: </p>
<br/>
<div ng-repeat="item in data"> <input type="text" ng-model="item.text"/> <input type="text" ng-model="item.text2"/> </div>
<br/>
<button type="button" ng-click="reset()">Reset</button>
</div>
input{
margin-top:10px;
}
External resources loaded into this fiddle: