-3

I have a JSON that I would like to put in the front end of my web application to be split into multiple tables (4 in precise).

Right now I have all my data from the JSON list is displayed in one table.

I am using AngularJS. Is there a way to split data into multiple tables without making changes to the database in the SQL Server (splitting by 4).

Aleksey Solovey
  • 4,153
  • 3
  • 15
  • 34
Madhav
  • 13
  • 4

1 Answers1

0

Here is an example:

angular.module('myApp', []).controller('personCtrl', function($scope) {
    $scope.test = [
        {name:'audi1',price:'200'},
        {name:'audi2',price:'200'},
        {name:'audi3',price:'200'},
        {name:'audi4',price:'200'},
        {name:'audi5',price:'200'},
        {name:'audi6',price:'200'},
        {name:'audi7',price:'200'}
    ];
});

<div class="row">
        <div class="col-md-6" ng-repeat="group in [0,1] ">
            <p>{{group}}</p>            
            <p ng-repeat="t in test" ng-if="group == test.indexOf(t) >= test.length/2" > 
              {{t}}              
            </p>
            <br>
        </div>
    </div>

Which will output:

0

{"name":"audi1","price":"200"}

{"name":"audi2","price":"200"}

{"name":"audi3","price":"200"}

{"name":"audi4","price":"200"}


1

{"name":"audi5","price":"200"}

{"name":"audi6","price":"200"}

{"name":"audi7","price":"200"}
Matheno
  • 4,112
  • 6
  • 36
  • 53