it seems that there are some questions online with similar matters but no solution worked for me.
I'm having a directive, let's say that includes a function like this (within the directive):
link: function(scope, element, attrs) {
scope.myfunction = function (){
console.log('function run');
};
}
Witch i want to make it run (call it) from a controller with something simple like this:
$scope.myFunction();
So i can call it from a part of my page outside the directive code let's say like this:
<button ng-click="myFunction()">Run</button>
Is it possible?