1

I am using Angular JS table ng repeat to display values

This is my code

<div ng-app="myapp" ng-controller="FirstCtrl">
     <table border="1">
  <tr>
    <th ng-repeat="(key, val) in collectioninfo">{{ key }}</th>
  </tr>
<tr ng-repeat="row in collectioninfo">
      <td ng-repeat="(key, val2) in row">
        {{ val2 }}
      </td>
    </tr>
</table>  
</div>

var myapp = angular.module('myapp', []);
myapp.controller('FirstCtrl', function ($scope) {
    $scope.collectioninfo = {
        "SDDD": "Working",
        "RRR": "P",
        "DateCreated": "57:52.2"
    }
});

http://jsfiddle.net/9fR23/501/

1 Answer 1

3

Try this. collectioninfo is object so you don't need two nested ng-repeat

var myapp = angular.module('myapp', []);
myapp.controller('FirstCtrl', function($scope) {
  $scope.collectioninfo = {
    "SDDD": "Working",
    "RRR": "P",
    "DateCreated": "57:52.2"
  }
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="myapp" ng-controller="FirstCtrl">
  <table border="1">
    <tr>
      <th ng-repeat="(key, val) in collectioninfo">{{ key }}</th>
    </tr>
    <tr>
      <td ng-repeat="(key, val2) in collectioninfo">
        {{ val2 }}
      </td>
    </tr>
  </table>
</div>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.