I have this controller:
.controller('UserListEditorController', function ($scope) { $scope.status = { isopenFields: false, isopenFilters: false }; $scope.toggleDropdownFields = function($event) { $scope.status.isopenFields = !$scope.status.isopenFields; }; $scope.toggleDropdownFilters = function($event) { $scope.status.isopenFilters = !$scope.status.isopenFilters; }; }) And I have this directive:
.directive('myDraggable', ['$document', function($document) { return { link: function(scope, element, attr) { element.on('mousedown', function(event) { element.data('mousedown', true); }); element.on('focusin', function(event) { if (element.data('mousedown')) { Calling $scope.toggleDropdown } }); } }; }]); How do I call a function that is in controllers $scope from the custom directive?
<div myDraggable></div>scope.toggleDropdown()?