Can you define multiple restrict options on a directive?
Answers
Answered by
1
Two directives on the same element can not both have isolated scope, but can they both use the same scope isolated from their parent? And can they both use properties bound to the isolated scope?
For example, if I have two directives on an element
<e-directive a-directive prop="parentProp"/>
And one directive defines an isolated scope with a bound property
App.directive('eDirective', function() { return { restrict: 'E', scope: { localProp: '=prop' }, ... }; });
Does the other directive get that scope and can it use the bound property?
App.directive('aDirective', function() { return { restrict: 'A', link: function postLink(scope, element, attrs) { scope.$watch('localProp', function(newProp, oldProp) { ... } }, ... }; });
For example, if I have two directives on an element
<e-directive a-directive prop="parentProp"/>
And one directive defines an isolated scope with a bound property
App.directive('eDirective', function() { return { restrict: 'E', scope: { localProp: '=prop' }, ... }; });
Does the other directive get that scope and can it use the bound property?
App.directive('aDirective', function() { return { restrict: 'A', link: function postLink(scope, element, attrs) { scope.$watch('localProp', function(newProp, oldProp) { ... } }, ... }; });
Similar questions