Reputation: 7083
I am loading data dynamically to ng-repeat so once i receive data its not binding it to ul
, i know sometime it happens if you have duplicate indexes but in below case i am not sure what is happening, Any idea ?
main.html
<div>
<ul ng-repeat="message in data track by index">
<li>{{message}}</li>
</ul>
</div>
ctrl.js
angular.module('loggingApp').controller('DitCtrl',function ($scope,DitFactory) {
'use strict';
DitFactory.getLogs().then(function (response) {
$scope.data = response.data;
console.log($scope.data);
});
});
console.log
printing data in console
["test.txt", "test1.txt", "test2.txt", "test3.txt", "test4.txt"]
Upvotes: 0
Views: 200
Reputation: 3025
Your ng-repeat needs to look like this:
ng-repeat="message in data track by $index"
Upvotes: 5