I had a List like this:
<ion-item ng-repeat="item in items" ng-click="itemClick({{item[0]}})">
...
</ion-item>
now I changed it to:
<ion-item collection-repeat="item in items" ng-click="itemClick({{item[0]}})">
...
</ion-item>
while having the following code in my controller:
$scope.itemClick = function (index) {
// index is undefined
};
before making the change from ng-repeat to collection-repeat all works fine. Now I get index as undefined.
Whats wrong here?
EDIT:
Here are my items:
var items = {
[1, "foo"],
[2, "bar"],
...
}
{{}} Iterpolation won't work inside ng-click, you can directly mention variable name that will directly gets fetched from their respective variable.
ngClickclearly states that it accepts an expression: http://docs.angularjs.org/api/ng.directive:ngClick
Markup
<ion-item collection-repeat="item in items" ng-click="itemClick(item[0])">
...
</ion-item>
try this
<ion-item collection-repeat="item in items" ng-click="itemClick(item[0])">
...
</ion-item>
if you want only index value, then try this below
<ion-item collection-repeat="item in items" ng-click="itemClick($index)">
...
</ion-item>
{{}} won't work inside ng-click, just del{{}}, use itemClick(item[0]).