I am currently facing an issue with ng-table while displaying my data. I noticed that when I enter data on the first page and then navigate to the second page, the values from the first page get cleared. Is there a way to retain the previously entered values? Please review my work files. Thank you.
var electricityApp = angular.module("myApp", ["ngTable"]);
electricityApp.controller(
'electricityCtrl',
function($scope, $http,NgTableParams) {
$scope.dmydata=[
{ name: "Sam", age: "35"},
{ name: "Ravi", age: "40"},
{ name: "Kumara", age: "50"},
{ name: "James", age: "60"},
{ name: "Sam2", age: "70"},
{ name: "Ravi2", age: "75"},
{ name: "Kumara2", age: "80"},
{ name: "James2", age: "85"},
{ name: "kamal", age: "90"},
{ name: "Sunil", age: "95"},
];
$scope.getDatas = function(){
$scope.tableParams = new NgTableParams({count:5}, { dataset:$scope.dmydata});
}
});
<!DOCTYPE html>
<html lang="en-US">
<script src="angular.js"></script>
<script src="ng-table.min.js"></script>
<link rel="stylesheet" href="ng-table.min.css">
<link rel="stylesheet" href="bootstrap.min.css">
<script>
</script>
<body>
<div ng-app="myApp">
<div ng-controller="electricityCtrl">
<table ng-table="tableParams" ng-init="getDatas()" class="table table-condensed table-bordered table-striped" show-filter="true">
<tr ng-repeat="user in $data">
<td title="'Name'" sortable="'name'">{{user.name}} <input type="text" ng-model="mytxt[$index]"/> </td>
<td title="'Age'" sortable="'age'">{{user.age}} <select ng-model="myselect[$index]"> <option> 1</option> <option> 2</option> <option> 3</option></select></td>
</tr>
</table>
</div>
</div>
</body>
</html>