Skip to content Skip to sidebar Skip to footer

Looping Through A Javascript Object's Array With Angular

So I'm absolutely new to writing any type of code, I'm trying to build a simple website using AngularJS and I'm having a problem with looping through a controller's object array th

Solution 1:

Here is a shot:

<divng-repeat="i in items"><h1>{{ i.name }}</h1><ul><ling-repeat="item in i.list">{{i}} </li></ul></div>

And the description:

Basically you want to loop through all the items in your array <div ng-repeat.. then for each of those items you want to create the <ul>

Solution 2:

It's simple -- replace your <script> with this:

<ul><ling-repeat="item in items">{{ item.name }}
        <ulid="items"><ling-repeat="list_item in item.list">{{ list_item }}</li></ul></li></ul>

Post a Comment for "Looping Through A Javascript Object's Array With Angular"