I'm trying inside a directive to access a method which is defined in the scope of my directive controller
This is a piece of my directive
angular.module('myApp', []).directive('jqmultiselect', function($timeout){
return {
restrict: 'A',
scope: {
info: '=info',
},
link: function (scope, element, attrs, ngModelCtrl) {
$timeout(function(){
//simple example
$(element).click(function(){
//do something with info
info = 'test';
scope.$eval(attrs.customclick);
});
});
}
};
}).controller('MainCtrl', function ($scope, $http, $timeout){
$scope.myInfo="test";
$scope.reloadModule = function(info){
console.log(info);
};
});
What I am trying to do is to call a function named "reloadModule()" in the controller through attribute tag of a HTML element
piece of my HTML code
<select
jqmultiselect
info="myInfo"
customclick="reloadModule(info)">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
More specific example is on the Jsfiddle http://jsfiddle.net/7j3HV/2/
Do you know how can I make it display the alert with "change ok" inside ?