This cards needs to be rewritten.
Say you have the following markup:
{{ someParentVariable = 42 }}
<child var="{{ someParentVariable }}" ng-click="foo()">
{{ var }}
</child>
Any angular expression on the child
element will be evaluated
before child
is initialized. Hence, {{ }}
is always evaluated in the
parent scope. attributes.foo
will be "42"
inside the child
directive
(as a string, because HTML attributes are always strings).
scope: true
If the child
directive sets scope:true
, a new child scope is
attached to the directive's element. It is available to any
other Angular expression on that element. ngClick
will invoke
the foo()
function that the child
directive defines.
scope: {}
Now assume the child
directive defines an isolate scope. This isolate
scope will be truly isolate and not accessible to other Angular
expressions or directives on that element. See this Stackoverflow
answer, section "Breaking Change" (Angular 1.2+). ngClick
will
invoke the foo()
function defined on the parent scope.
Links
- More on parent scope data bindings in this great Stackoverflow answer Show archive.org snapshot (section "Better anwer")