aboutsummaryrefslogtreecommitdiffstats
path: root/docs/content
diff options
context:
space:
mode:
authorBrad Williams2014-02-13 19:55:35 -0800
committerCaitlin Potter2014-02-20 15:18:47 -0500
commit45304a9d683128261791461f4dc47a180444b5b0 (patch)
tree9b89cf1f2c79eccea51d517325ed377ff099217f /docs/content
parent0478bb4a6034e3072684201b9384f7ddfe109073 (diff)
downloadangular.js-45304a9d683128261791461f4dc47a180444b5b0.tar.bz2
docs(guide/directive): add a more detailed description of isolate scope `&` bindings
More description of "&" bindings, the fact that they trigger evaluation of expressions in the original scope's context. Closes #6255
Diffstat (limited to 'docs/content')
-rw-r--r--docs/content/guide/directive.ngdoc11
1 files changed, 8 insertions, 3 deletions
diff --git a/docs/content/guide/directive.ngdoc b/docs/content/guide/directive.ngdoc
index 6c81419a..da270d7e 100644
--- a/docs/content/guide/directive.ngdoc
+++ b/docs/content/guide/directive.ngdoc
@@ -736,9 +736,14 @@ We want to run the function we pass by invoking it from the directive's scope, b
in the context of the scope where its registered.
We saw earlier how to use `=attr` in the `scope` option, but in the above example, we're using
-`&attr` instead. `&` bindings expose a function to an isolated scope allowing the isolated scope
-to invoke it, but maintaining the original scope of the function. So when a user clicks the
-`x` in the dialog, it runs `Ctrl`'s `hideDialog` function.
+`&attr` instead. The `&` binding allows a directive to trigger evaluation of an expression in
+the context of the original scope, at a specific time. Any legal expression is allowed, including
+an expression which contains a function call. Because of this, `&` bindings are ideal for binding
+callback functions to directive behaviors.
+
+When the user clicks the `x` in the dialog, the directive's `close` function is called, thanks to
+`ng-click.` This call to `close` on the isolated scope actually evaluates the expression
+`hideDialog()` in the context of the original scope, thus running `Ctrl`'s `hideDialog` function.
<div class="alert alert-success">
**Best Practice:** use `&attr` in the `scope` option when you want your directive