How to divide a json into several parts in AngularJS -


i designing waterfall page, , these days i'm getting started on angularjs. wanna divide json data several parts display wrap each in different div. whole data in array, called items. <div id="dym-waterfall"> <div class="dym" ng-repeat="item in items"> </div>
<div class="dym" ng-repeat="item in items"> </div>
<div class="dym" ng-repeat="item in items"> </div>
<div class="dym" ng-repeat="item in items"> </div>
</div>

there couple of ways of solving problem.

firstly, assign scope value every part in "items". instance, assume json array:

[data1, data2, data3, data4, data5] 

and in controller this:

$scope.data1 = items[0]; 

do every part need broken up. keep in mind 'data1' part arbitrary , can make name want. in html:

<div class="dym" ng-repeat="stuff in data1"></div> 

alternatively, have html this:

<div class="dym" ng-repeat="item in items[0]></div> 

the first method better if have additional processing, , other if data structure ready go already.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo