Posts

Showing posts with the label json object

ng-repeat working with JSON objects

today i had quite  a fight vs ng-repeat while trying to loop over some json objects i'll just sum it cause in the end its quite easy. you can try it yourself, I prepared a little jsbon for it: http://jsbin.com/roranijaba/1/edit?html,output 1 - simple array this is just for the sake of the example, when your object in an array, ngRepeat looks like this < div ng-init ="friends = ['Jhonny','Jessy','Marky']">   < ul >     < li ng-repeat ="friend in friends">       {{ friend }} .     </ li >   </ ul > </ div > 2 - array of json objects this is where you can use the power of parameter with ngRepeat < div ng-init ="friends = [{name:'John', age:25, gender:'boy'},        {name:'Jessie', age:30, gender:'girl'},        {name:'Patrick', age:40, gender:'boy'}]">   ...