Reputation: 115
I have a directive with isolate scope. The directive's template has a ng-repeat on an element. On the same element I have:
ng-click="selection(item)"
Within the scope of my directive I have:
scope: {
selection: '&'
}
The attribute on the directive looks like:
selection="onSelection(item)"
The controller looks like:
$scope.onSelection = function(item) {
}
The function is being called but the item is undefined. I'm convinced the item is there because I'm also using ng-class="getClass(item)" again on the same element which is working fine.
Any helpful pointers would be appreciated.
Cheers.
Upvotes: 2
Views: 120
Reputation: 42669
Well as it turns out the correct syntax is
ng-click="selection({'item':item})"
Upvotes: 1