Answer the question
In order to leave comments, you need to log in
How to get value from parent scope in Angular directive?
Hello.
I wrote a directive, in which I need to get the property of an object located in the parent scope.
angular
.module('module')
.directive('civilization', function factory() {
return {
template: '<div class="civilization"></div>',
replace: true,
restrict: 'A',
//// создавать/не создавать замыкание области видимости
scope: false,
// здесь находится основная функциональность директивы
link: function (scope) {
console.log(scope.node);
}
}
});
console.log(scope);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question