I got transcluded directive, for example 'aDirective' and other random 'bDirective' directive. My task is: I want to get a 'aDirective's scope variable and catch it in 'bDirective'.
angular.module('myApp',[])
.controller('bDirective',['$scope',function(scope){
scope.getScopeVar = function () {
// here I want to get aDirective - s 'someVar' variable
scope.someVar;
debugger;
};
scope.getScopeVar();
}])
.directive('aDirective',function(){
return{
scope:{},
transclude:true,
template:'<div>123</div>',
link: function(scope, element, attrs, controller, transclude){
scope.someVar = 'asd';
transclude(scope, function (clone) {
element.append(clone);
});
}
};
});
Any solutions? Regards Nick.