I've a question in angularjs.
In my controller, I've a comma separated string, and I will show it in my index.html(with ng-repeat)
Here is my controller:
myApp.controller('TabsDemoCtrl',function($scope,$http){
$http.get('/performbatch').success(function(data) {
$scope.string = 'Gzrgh,1,2,1,4,1,1,1,20150304,20180304';
$scope.arrString = new Array();
$scope.arrString = $scope.string.split(',');
});
Here is my html :
<div ng-controller="TabsDemoCtrl">
<td ng-repeat="icerik in arrString">
{{icerik}}
</td>
</div>
But I couldn't achieve that. Can you help me? Thanks in advance.
Here is plunker for you
You need to use track by $index because it is having duplicate value in array.
ng-repeat="icerik in arrString track by $index"
You can't have td
outside table
.
It must be like
<div ng-repeat="icerik in arrString track by $index">
{{icerik}}
</div>
Also since some are duplicates items, you must add track by $index
as well
DEMO
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With