Good day mate, i just want to ask how can i use a function from my controller inside my custom directive?
the scenario is a have a directive that's restrict the panel views for different user so i need to construct a function that's evaluate the user. i want to declare that function in a controller so i can use it to another controllers and the same time with directives too.
//my directive: 
app.directive("restricted", function() {
     return {
        restrict: 'A',
        link: function(scope, element, attrs) {
            // Some auth check function
            var isAuthorized = checkAuthorization();
            if (!isAuthorized) {
                element.css('display', 'none');
            }
        }
    }
})
//my function inside controller
app.controller('myController', ['$scope', function() {
    $scope.checkAuthorization = function() {
           //Code here. . .
    }
})];
thanks guys
 
    