Reputation: 133
I'm trying to access value that is passed from the parent's directive on the child directive's template function.
Please refer to the below plunker.
CODE:
Parent Directive:
directive('parentDir', function(){
return {
controller: ['$scope',function($scope){
$scope.myVal = 'HELLO';
}],
templateUrl: 'parentDir.html'
}
})
Child Directive:
directive('childDir', function(){
return {
template: function(element,attrs){
alert(attrs.val);
}
}
})
parentDir.html:
<div>
<child-dir val="{{myVal}}"></child-dir>
</div>
Upvotes: 1
Views: 2829