user8727958
user8727958

Reputation: 23

how to iterate ng-repeat with key,value to show values individually

I want to iterate and display the values from "detailsController".

<div ng-controller="detailsController">
         <div ng-repeat="data in details" id="{{data.Id}}">
                {{data.Name}}
         </div>
      </div>

Upvotes: 2

Views: 48

Answers (1)

Guillaume Georges
Guillaume Georges

Reputation: 4020

By adding a new ng-repeat using (key, value) you can iterate through the properties of the objects in details :

  <div ng-if="show ==4" ng-controller="detailsController">
       <div ng-repeat="data in details" id="{{data.Id}}">
         <p ng-repeat="(key, value) in data">
          {{value}}
         </p>
     </div>
  </div>

Is that what you're trying to achieve?

I forked your plnkr here

Upvotes: 1

Related Questions