I am trying to create a directive by wrapping jquery autocomplete plugin somthing like this
<input class="form-control" auto-complete ui-items="list" modvar="selectedSvr" callback="myfunction"/>
I want to call whichever function I pass to callback attribute, how can i achieve this?
here's my directive
app.directive('autoComplete', function() {
return function($scope, iElement, iAttrs) {
iElement.autocomplete({
source: $scope[iAttrs.uiItems],
select: function (event,ui) {
$scope.$apply(function () {
$scope[iAttrs.modvar] = ui.item.value;
// maybe register/call myfunction here
})
}
});
};
});