0

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.

2
  • 1
    Have you tried anything to generate your table? Commented Mar 15, 2016 at 9:43
  • Does it's response like this 1,2,5,6 or like 1,2 --first row 5,6 --2nd row Commented Mar 15, 2016 at 10:26

1 Answer 1

1

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

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.