R.Anandan R.Anandan - 1 month ago 15
AngularJS Question

ionic.bundle.js:25642 Error: [ngRepeat:iexp] Expected expression in form of '_item_ in _collection_[ track by _id_]' but got 'cdata.catagoriesdata'

I am trying to create a ionic mobile app in that i am getting an error in ng-repeat the error is


ionic.bundle.js:25642 Error: [ngRepeat:iexp] Expected expression in form of 'item in collection[ track by id]' but got 'cdata.catagoriesdata'


please any one help me to solve this issue then i have added my code below



.controller('categoriesdatactrl', ['$scope', '$stateParams', // The following is the constructor function for this page's controller. See https://docs.angularjs.org/guide/controller
// You can include any angular dependencies as parameters for this function
// TIP: Access Route Parameters for your page via $stateParams.parameterName
function ($scope, $stateParams) {
$scope.catagoriesdata=[{"title":"anandan"},{"title":"anandan1"}];

}])

<ion-view title="Categories" id="page3">
<ion-content padding="true" class="has-header">

<ion-list id="categories-list2" ng-repeat="cdata.catagoriesdata">
<ion-item class="item-thumbnail-left assertive" id="categories-list-item20" >

<h2>{{cdata.title}}</h2>
</ion-item>

</ion-list>
</ion-content>
</ion-view>




Answer

change your ng-repeat like this

ng-repeat="cdata in catagoriesdata track by $index"
Comments