I'm writing a directive and it looks like this :
return {
restrict: 'E',
replace: false,
scope: {
getl: '&'
},
template: function()
{
return '<div data-ng-click="load_page(1)"></div>';
},
link: function(scope)
{
scope.current_page = 1;
scope.load_page = function(increment)
{
scope.current_page += increment;
scope.getl(scope.current_page);
}
}
};
I'm calling this directive like this:
<pager list="events" max="max_page" getl="get_events()"></pager>
What I'd like to do is being able to call the "getl" function from the "link" function of my directive but when I do so, I get the following error:
TypeError: Cannot use 'in' operator to search for 'f_get_events' in 2
I guess I'm missing something here but the only examples I found on Google were using the function in the template and I'd rather not to do like this.
Thanks for your help