Angular ng-repeat for comma separated strings


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:

    $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">

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"

Answered By – squiroid

Answer Checked By – Katrina (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.