@@ -152,10 +152,12 @@ abstract class Directive {
152
152
* watch on expression. Once the expression turns truthy it will no longer
153
153
* update. (cost: 1 watches until not null, then 0 watches)
154
154
*
155
- * * `&` - Treat the DOM attribute value as an expression. Assign a closure
156
- * function into the field. This allows the component to control
157
- * the invocation of the closure. This is useful for passing
158
- * expressions into controllers which act like callbacks. (cost: 0 watches)
155
+ * * `&` - Treat the DOM attribute value as an expression. The expression is
156
+ * compiled and bound to the scope context. The resulting [BoundExpression]
157
+ * is assigned to the designated field. The component can evaluate the
158
+ * expression by calling the [BoundExpression] when needed. This is useful
159
+ * for passing expressions into controllers which act like callbacks. (cost:
160
+ * 0 watches)
159
161
*
160
162
* Example:
161
163
*
@@ -172,25 +174,25 @@ abstract class Directive {
172
174
* class MyComponent {
173
175
* String title;
174
176
* var currentItem;
175
- * ParsedFn onChange;
177
+ * BoundExpression onChange;
176
178
* }
177
179
*
178
- * The above example shows how all three mapping modes are used.
180
+ * The above example shows how all three mapping modes are used:
179
181
*
180
- * * `@title` maps the title DOM attribute to the controller `title`
182
+ * * `@title` maps the title DOM attribute to the component `title`
181
183
* field. Notice that this maps the content of the attribute, which
182
184
* means that it can be used with `{{}}` interpolation.
183
185
*
184
186
* * `<=>currentItem` maps the expression (in this case the `selectedItem`
185
- * in the current scope into the `currentItem` in the controller . Notice
187
+ * in the current scope into the `currentItem` in the component . Notice
186
188
* that mapping is bi-directional. A change either in field or on
187
189
* parent scope will result in change to the other.
188
190
*
189
- * * `&onChange` maps the expression into the controller `onChange`
190
- * field. The result of mapping is a callable function which can be
191
- * invoked at any time by the controller . The invocation of the
192
- * callable function will result in the expression `doSomething()` to
193
- * be executed in the parent context .
191
+ * * `&onChange` parse the expression ( `doSomething()` ), bind it to the
192
+ * parent context, the resulting [BoundExpression] is assigned to the
193
+ * controller `onChange` field . The [BoundExpression] is a callable object
194
+ * which can be invoked at any time by the component. The invocation of
195
+ * `onChange` will result in the expression `doSomething()` to be executed .
194
196
*/
195
197
final Map <String , String > map;
196
198
@@ -512,10 +514,9 @@ class NgTwoWay extends DirectiveAnnotation {
512
514
}
513
515
514
516
/**
515
- * When applied as an annotation on a directive field specifies that
516
- * the field is to be mapped to DOM attribute with the provided [attrName] .
517
- * The value of the attribute to be treated as a callback expression,
518
- * equivalent to `&` specification.
517
+ * When applied as an annotation on a directive field specifies that the field is to be mapped to
518
+ * DOM attribute with the provided [attrName] . The value of the attribute to be treated as a
519
+ * an expression, equivalent to `&` specification.
519
520
*/
520
521
class NgCallback extends DirectiveAnnotation {
521
522
final _mappingSpec = '&' ;
0 commit comments