in a Cordova app I have been attempting to bind angular mark-up like this:
<table class="table table-striped table-responsive">
<thead>
<tr>
<th>Rotation</th>
<th>ID</th>
<th>Name</th>
<th>DOB</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in dtPatients track by item.fldRotation">
<td>{{item.fldRotation}}</td>
<td>{{item.fldID}}</td>
<td>{{item.fldTitle + " " + item.fldForename + " " + item.fldSurname}}</td>
<td>{{item.fldDOB | date:'dd/MMM-yy'}}</td>
</tr>
</tbody>
</table>
To a simple WebSQL transaction in a controller like this:
tx.executeSql("Select * from [tblPatients];"
, []
, function (tx, results) {
if (results.rows.length == 0) {
$scope.dtPatients = null;
$scope.$apply();
}
else {
// We have records so we create an array of the results
$scope.dtPatients = results.rows;
$scope.$apply();
debugger;
}
}
, function (tx, err) {
console_log("Error retrieving patients.");
$scope.dtPatients = null;
logdberror(err.code, err.message);
errorsource = -1;
ShowError('PatientsController1 load patients', err.code.toString + " " + err.message);
$scope.$apply();
}
);
This produces an error and the only way round it is to use code like that shown here to convert the rows to an array. I notice the error the author documented in the link talked about but I am not sure that is the error I am getting. I have also tried changing the ng-repeat from that shown above back to what I had from the beginning of
ng-repeat="item in dtPatients"
Either way I keep getting the same error. Surely it is not necessary to convert the SQL Resultset to an array before binding?
Here's the error being given:
10 $digest() iterations reached. Aborting! Watchers fired in the last 5 iterations: [[{"msg":"fn: function (c,d){var e=a(c,d);return b(e,c,d)}","newVal":17,"oldVal":15}],[{"msg":"fn: function (c,d){var e=a(c,d);return b(e,c,d)}","newVal":19,"oldVal":17}],[{"msg":"fn: function (c,d){var e=a(c,d);return b(e,c,d)}","newVal":21,"oldVal":19}],[{"msg":"fn: function (c,d){var e=a(c,d);return b(e,c,d)}","newVal":23,"oldVal":21}],[{"msg":"fn: function (c,d){var e=a(c,d);return b(e,c,d)}","newVal":25,"oldVal":23}]] at Error (native) at localhost:4400/scripts/angular.min.js:6:417 at n.$get.n.$digest (localhost:4400/scripts/angular.min.js:124:185) at n.$get.n.$apply (localhost:4400/scripts/angular.min.js:126:293)
Thanks in advance for any help / advice.