displaying the angular get response in html table format in a div

I am working on angular-fullstack generator. I am getting the data in response of get request which is in form of integer values (1 ,2
5,6
134, 245
236,567
415,234 and so on) I want to show these values in my front end in form of html table with two columns that it will look like following

     col1  col2
       1    2
       5    6
      134   245 and so on 

below is my html div where i want to display it

 <div id="tabdata" >

 </div>

My angular controller code for http get

$scope.getdata =function(){
$http.get("/getdata" ).success(function(response){
$scope.output=response;
})

The table should be get adjusted according to the content coming from the response. Thanks in advance for reply.

Upvotes: 0

Views: 978

Answers (1)

Slytherin
Slytherin

Reputation: 474

Read about ng-repeat

Based on structure of your data, you could use something like

<tr ng-repeat="row in dataset">
    <td ng-repeat="cell in row">{{cell.value}}</td>
</tr>

You could of course write your own directive, or if you know the incoming structure beforehand,specify cells accordingly (as to avoid nested repeat)

Tracking can be useful for larger datasets

Upvotes: 1

Related Questions