I have an angular-js controller returning json data from the database. I bind the returned data to the $scope.details var in the success function.
In the HTML I use the NG-REPEAT to show all the rows with the values
<tr ng-repeat="detail in details">
<td><span>{{detail.timestamp}}</span></td>
<td>{{detail.T_AC}}</td>
<td>{{detail.T_OH}}</td>
<td>{{detail.T_AW}}</td>
<td>{{detail.T_UD}}</td>
<td>{{detail.T_AT}}</td>
<td>{{here the TOTAL of all T_* should show}}</td>
</tr>
The last field shall calculate the sum of all the detail.T_* fields (which are all integers) when I use the {{detail.T_AC + detail.T_OH}} it's not doing the actual sum, but rather glues the numbers together (eg. 1+1 shows 11 instead of 2)
The function and the controller are:
myApp.controller("databasecontroller",['$scope','$http',function($scope,$http){
function getInfo() {
$http.post('phpscripts/returndata.php').success(function(data) {
$scope.details = data;
});
}
}]);