i want add 2 values using angular js . have fetched values database using $http.get($scope.url) , using values on html page. want add " 1" in value. code :- app.js
mainapp.controller("displaycontroller", ['$scope', '$http', 'sharedataservice', function($scope, $http, sharedataservice) { $scope.url = 'incomebenefit.php'; $http.get($scope.url) .then(function (response) {$scope.names = response.data.records; for(x in $scope.names){ var t_age = $scope.names[x]['client_age']; var t_premium = $scope.names[x]['premium']; } $scope.t_age = t_age; $scope.t_premium = t_premium; }); }]);
and html page :-
<ul id="form-bt-main" class="sec-row" ng-repeat="n in [] | range:31"> <li class="form-bt">{{n}}</li> <li class="form-bt">{{t_age = t_age +1}}</li> </ul>
i want add '1' in t_age. t_age = '24' , want values 24 25 26 27 28 29 30 in li on output screen.
angular.module('app',[]).controller('ctrl',function($scope){ $scope.age = parseint('24'); $scope.names = ["singh","jorawar","kiran"]; }); <body ng-controller="ctrl"> <div ng-repeat="name in names"> {{name}}<br> {{age + $index - 1 + 1}} </div> </body>
Comments
Post a Comment