Savita Savita - 1 year ago 41
AngularJS Question

display jsonArray in angular js table format

I am getting response data as

array=[{"job id":"1",
"level 1":"er",
"level 2":"ED",
"level 3":"MT",
{"job id":"2",
"level 1":"ear",
"level 2":"ED",
"level 3":"MT",

In above array there are 2 records retrieved from database and it may vary accordingly .

And I want to represent in Table format and column must be job id ,level 1, level 2 etc and values 1,ed, etc as in angular JS.

Answer Source

Try use (key,value) in ng-repeat

var app=angular.module('app',[])
          {"job id":"1","level 1":"er","level 2":"ED","level 3":"MT","status":"mt"},
          {"job id":"2","level 1":"ear","level 2":"ED","level 3":"MT","status":"mt"}

<script src=""></script>
<div ng-app="app" ng-controller=" Ctrl">
  <table border="1">
        <tr ng-repeat="(key,value) in array" ng-if="$last">
         <td ng-repeat="(key,v) in value">{{key}}</td>
       <tr ng-repeat="(key,value) in array">
         <td ng-repeat="(key,v) in value">{{v}}</td>