i trying use ng repeat values array
here html
<ion-list ng-repeat="item in locationresult"> <ion-item > <ion-checkbox ng-repeat="inneritem in item.loc[$index]"> <h2>{{inneritem.name}}</h2> <p>income:1334 vs expences:3742</p> </ion-checkbox> </ion-item> </ion-list> here controler
angular.module('starter').controller('locationctrl', function($scope, $state, userlog, $http, $timeout) { $scope.init = function() { $timeout(function() { alert(userlog.email); document.getelementbyid("locresult").textcontent = ""; var request = $http({ method: "post", url: "http://expensetracker.linkwebz.com/home/locationsearch", data: { email: userlog.email, }, headers: {'content-type': 'application/x-www-form-urlencoded'} }); /* check whether http request successful or not. */ request.success(function(data) { console.log(data); $scope.locationresult = data; }); }); }; }); here data object
object { loc: array[3] } object loc:array[3] 0:object iduhlocation:"1" location_idlocation:"1" name:"mark" user_iduser:"177" _proto_:object 1:object 2:object length:3 _proto_:array[0] _proto_:object i tried repeat data mention above html it's not working how iterate through array , show data in html have idea one?
you can use 1 ng-repeat if data have shown as:
<ion-list ng-repeat="item in locationresult['loc']"> <ion-item > <ion-checkbox> <h2>{{item.name}}</h2> <p>income:1334 vs expences:3742</p> </ion-checkbox> </ion-item> </ion-list>
Comments
Post a Comment