There are two ways to achieve the goal:
you can use an isolated area:
myapp.directive('header', function() {
return {
scope: {
breadcrumbs: "@"
},
templateUrl: '../../partials/header.html'
};
});
or attrfunction attribute link:
myapp.directive('header', function() {
return {
templateUrl: '../../partials/header.html',
link: function(scope, element, attrs){
scope.breadcrumbs = attrs.breadcrumbs
}
};
});
UPD:
breadcrumbs (<header breadcrumbs="{{breadcrumbs}}"></header>), :
:
myapp.directive('header', function() {
return {
scope: {
breadcrumbs: "="
},
templateUrl: '../../partials/header.html'
};
});
attr link:
myapp.directive('header', function() {
return {
templateUrl: '../../partials/header.html',
link: function(scope, element, attrs){
scope.breadcrumbs = scope.$eval(attrs.breadcrumbs)
}
};
});