I am trying to get data from SQLite DB. While displaying data I am getting : “Duplicates in a repeater are not allowed” on ng-repeat error toavoid that I added track by index. But, this created new issue it splits my string and displays single letter as a list.
Following is my code.
HTML:
Controller:
$scope.load = function() {
// Execute SELECT statement to load message from database.
$cordovaSQLite.execute(db, 'SELECT * FROM Customer_local_ ORDER BY id DESC')
.then(
function(result) {
if (result.rows.length > 0) {
for(var i=0;i<result.rows.length;i++){
//$scope.newMessage
$scope.arrcust= result.rows.item(i);
// $scope.statusMessage = "Message loaded successful, cheers!";
console.log("Db data feteched"+result.rows.item(i).first_name+result.rows.length);
/* $ionicPopup.alert({title:'Welcome',
template:'Customer retrived succefully!'+$scope.newMessage});*/
}
}
console.log(" Cust local arr : "+$scope.arrcust.length);
},
function(error) {
$scope.statusMessage = "Error on loading: " + error.message;
}
);
}
HTML:{
ion-item ng-repeat=“item in arrcust track by $index”
}