I am trying to pass the function(removeItem
) to the the isolate scope of the directive, and then call this function inside the directive's template, however that function gets called but without the arguments. I tried like this:
<my-directive remove="removeItem(item)"></my-directive>
place where removeItem
is defined:
scope.removeItem = function(item) {
console.log('item removed');
}
isolate scope:
scope: {
remove: "&"
}
and directive template:
<div ng-repeat="item in allItems | selectedItemFilter" >
<label>{{ item.description }}</label>
<div>
<button ng-click="remove(item)"> Remove</button>
</div>
</div>
So when the remove button is clicked, the actual removeItem
is called, but without the item argument, which is undefined. I tried also with passing the simple string argument but removeItem
never gets it, it is also undefined. What could cause this behaviour ?