简体   繁体   中英

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>

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM