Reputation: 815
I'm new to angularjs, and trying this, but not sure why is it not working. I used quite a number of solutions found here, but none works.
Here is my array that is assigned to $scope.data_params
Here is my code in HTML:-
<tr ng-repeat="item in data_params">
<td>{{item.name}}</td>
Code in JS:-
$scope.data_params.push(result_params.dealers);
console.log($scope.data_params);
Any idea what went wrong?
Upvotes: 0
Views: 72
Reputation: 654
It seems that you need to access to the 0 element, Try:
<tr ng-repeat="item in data_params[0]">
<td>{{item.name}}</td>
Hope it helps,
Upvotes: 2
Reputation: 2706
It looks like your data is an array that contains an array of your items. Try ng-repeating on the inner-array:
<tr ng-repeat="item in data_params[0]">
<td>{{item.name}}</td>
Upvotes: 2
Reputation: 4425
From the looks of it your data_params
is a 1 length array that houses a 10 length array with the objects you want. You need to repeat over the 10 length array, not the 1 length.
<tr ng-repeat="item in data_params[0]">
<td>{{item.name}}</td>
</tr>
Upvotes: 2
Reputation: 827
You need to track by $index:
<tr ng-repeat="item in data_params track by $index">
<td>{{item.name}}</td>
Upvotes: 0