0

Why the data is not displayed in the table i have created.

Here is the link to PLUNKER

[[1]: https://plnkr.co/edit/O3YFmJqyereOKhHXg8v1?p=preview][1]

<table>
  <thead>
    <tr>
      <th>Login</th>
      <th>blog</th>
      <th>created_at</th>
    </tr>
  </thead>
  <tbody>
    <tr ng-repeat="r in user1 ">
      <td>{{r.login}}</td>
      <td>{{r.blog }}</td>
      <td>{{r.created_at}}</td>

    </tr>
  </tbody>
  </table>

But when i replace r by user1 in the above i get multiple rows with same content .Ideally i should get only 1 row

  <td>{{user1.updated_at}}</td>
      <td>{{user1.blog }}</td>
      <td>{{user1.created_at}}</td>

Can anyone explain the 2 issue that i have mentioned

2
  • user1 is a object not an array Commented Apr 17, 2018 at 12:27
  • so how can i display the data in the table?Or in other words how can i make my ng-repeat work Commented Apr 17, 2018 at 12:32

1 Answer 1

1

Push the object to an array and iterate it

$scope.user1 = [] ;
 var OnUserComplete = function (data ){
 $scope.user1.push(data)
};
Sign up to request clarification or add additional context in comments.

2 Comments

It's working $scope.user1 = [] ; convert object to array?
Yes, converting it to array so u can iterate in the table.

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.