AngularJS Module and Directives
angular.module('tabApp', [])
.directive('tabPanel', function () {
return {
scope: {
isOpen: '='
},
template: '<div><div tab-content></div>',
link: function (scope) {
alert(scope.isOpen);
}
};
})
.directive('tabContent', function () {
return {
scope: {
isOpen: '='
},
template: '<div>Content</div>',
link: function (scope) {
alert(scope.isOpen);
}
};
});
HTML
<div ng-app="tabApp">
<div tab-panel is-open="true"></div>
</div>
I need the tabContent to access isOpen property in the tabPanel? What is the best and shortest way to achieve this?