javascript - Calculate how many Array in the JSON -
i working on simple angularjs project, , have code:
this view:
<tr ng-repeat="metering in meterings"> <td>1</td> <td>{{metering.d.serialnumber}}</td> </tr>
this controller:
angular.module('mainctrl', []).controller('maincontroller', function($scope,$http,nerds) { nerds.get() .success(function(data){ $scope.meterings = data; }); });
this services:
angular.module('nerdservice', []).factory('nerds', ['$http', function($http) { return{ : function(){ return $http.get('http://amrse.net/list.json'); //let's pretend path works fine } } }]);
my questions are: 1. how can number 1 in table (in view) changes dynamically? <td>1</td>
- i want calculate total array repeat in
<td>{{metering.d.serialnumber}}</td>
. like:total : {{ metering.gettotal() }}
. how can that?
what metering.d (d) that's added server side added .net. if that's case use
$scope.meterings = data.d;
then can using meterings.length find length , number can go $index+1. hope helps
Comments
Post a Comment