How to get some data from the controller and use it inside the directive is not a problem. But I am confronted with a situation where I need to get data from a directive and use it in my controller.
For exmpl:
My controller:
function MyController($scope, $location, myDirective) { "use strict";
My directive:
.directive("myDirective", function() { "use strict"; return { restrict: 'A', template: '<div></div>', replace: true, scope: { data: '=', }, link: function(scope, elm) { scope.importantValue = "value"; function create() { console.log("Directive works..."); } }; })
How can I use the variables or methods from the directive inside my controller?
source share