I have some code in an Angular project that use two separate directives with isolated scope. They do not need to share scope, simply exist on the same element. They both alt
Summary of what happens when multiple directives are defined on the same element:
Scenario directive #1 directive #2 Result 1 no new scope no new scope Both directives use the controller's scope. (This should be obvious.) 2 new scope new scope Both directives share one new child scope. 3 new scope no new scope Both directives share one new child scope. Why does dir #2 use the child scope? This seems odd to me. 4 isolate scope no new scope Angular v1.0: both directives share the isolate scope. Angular v1.2+: dir #1 uses the isolate scope, dir #2 uses the controller's scope.
Note that the following scenarios are not allowed (Angular throws an error):
Scenario directive #1 directive #2 5 isolate scope new scope 6 isolate scope isolate scope