javascript - Angular looping multi dimensional json object not working -
i'm practicing angular , thought cool make shopping cart, have downloaded pre-made site template displays items in categories way layed out pretty like
<div class="row"> <ul> <li>item1</li> <li>item2</li> <li>item3</li> </ul> </div>
so every row in category grid div containing un ordered list of 3 items
here angular code:
<div ng-app="categoryloader" ng-controller="catloader"> <div ng-repeat="row in items"> <ul> <li class="new" ng-repeat="item in row"> <div class="catthum"><img src="http://cart.asccio.net/images/oxo---homepage_39.jpg" alt="" /><div class="new"></div></div> <div class="catdetail"> <h4><a href="#">{{item.name}}</a></h4> <p>{{item.price}}</p> </div> </li> </ul> </div> <div class="clr"></div> </div> <script type="text/javascript"> var app = angular.module("categoryloader", []); app.controller("catloader", function($scope, $http) { $http.get('http://cart.asccio.net/category/items/7'). success(function(data, status, headers, config) { $scope.items = data; alert("loaded items"); }). error(function(data, status, headers, config) { // log error alert("error"); }); }); </script>
and json data: http://paste.ofcode.org/mkv2qnz5j75ptbn48dvika can see ive split json data 3 items per segment should work design 1 item displaying , i'm getting error in browser console
"[cycle] terminating; 0 elements found selector" jquery.cycle.js:10:180 "error: this.parentnode null jquery.prototype.after/<@http://cart.asccio.net/js/jquery-1.3.2.js:274:4 jquery.prototype.dommanip@http://cart.asccio.net/js/jquery-1.3.2.js:522:1 jquery.prototype.after@http://cart.asccio.net/js/jquery-1.3.2.js:273:1 sd</this.$get</<.enter@https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js:140:127 ue</<.link/</<@https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js:185:315 b/<@https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js:41:449 w/<@https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js:43:170 a@https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js:46:352 ue</<.link/<@https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js:185:1 zd/this.$get</h.prototype.$watchcollection/<@https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js:98:313 zd/this.$get</h.prototype.$digest@https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js:99:209 zd/this.$get</h.prototype.$apply@https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js:101:473 f@https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js:66:319 f@https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js:70:242 md/</b.onreadystatechange@https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js:71:277
image of rendered result: http://i.imgur.com/k6jjzov.png
image of 'should' like: http://i.imgur.com/svql83p.png
what doing wrong?
"
i including jquery libraries angular.js library causing problems, comparability issues.
works fine now!
Comments
Post a Comment