Я получил включенную директиву, например ' aDirective ' и другую случайную директиву * bDirective '. Моя задача: я хочу получить переменную области видимости aDirective и перехватить ее в ' 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);
});
}
};
});
Какие-нибудь решения?
С уважением Ник.