i have this html:
<button ng-click="reset()">
<div ng-controller="anotherController" class="container">
<directive data="{{ datafordirective }}"></directive>
</div>
directive:
app.directive('directive', function(){
return {
restrict: 'AE',
scope:{ data: '=', someAction: '=', reset: '='},
link: function(scope, element, attrs){
scope.reset = function(){
//reset dataset
};
}
};
});
I have inside my directive a function at the link function to reset the data but the problem is that the view where im using this button and this directive have a different controller but both directive and this view controller belong to the same app.module('appname', [])...
is there a way to achieve this? to use the scope.reset() function outside the directive scope?
Thanks!