I have 2 directives on the same tag, <settings> and <modal>. settings provides a template, while modal creates an isolated scope:
var app = angular.module('app', []);
app.directive('settings', function () {
return {
restrict: 'E',
template: '<div>SETTINGS</div>',
link: function (scope) {
console.log('settings', scope.$id);
}
};
});
app.directive('modal', function () {
return {
restrict: 'A',
scope: {},
link: function (scope) {
console.log('modal', scope.$id);
}
};
});
However, they do not end up sharing the same scope, as shown by the logs:
<settings modal="settings"></settings>
settings 002
modal 003
Why is that ?