@@ -241,7 +241,6 @@ The full skeleton of the directive is shown here:
241
241
transclude: false,
242
242
restrict: 'A',
243
243
scope: false,
244
- local: {},
245
244
compile: function compile(tElement, tAttrs, transclude) {
246
245
return {
247
246
pre: function preLink(scope, iElement, iAttrs, controller) { ... },
@@ -319,35 +318,35 @@ compiler}. The attributes are:
319
318
* `{}` (object hash) - then a new 'isolate' scope is created. The 'isolate' scope differs from
320
319
normal scope that it does not prototypically inherit from the parent scope. This is useful
321
320
when creating reusable components, which should not accidentally read or modify data in
322
- parent scope. <br/>
321
+ parent scope. <br/>
323
322
The 'isolate' scope takes an object hash which defines a set of local scope properties
324
323
derived from the parent scope. These local properties are useful for aliasing values for
325
324
templates. Locals definition is a hash of normalized element attribute name to their
326
325
corresponding binding strategy. Valid binding strategies are:
327
326
328
327
* `attribute` - one time read of element attribute value and save it to widget scope. <br/>
329
- Given `<widget my-attr='abc'>` and widget definition of `locals : {myAttr:'attribute'}`,
328
+ Given `<widget my-attr='abc'>` and widget definition of `scope : {myAttr:'attribute'}`,
330
329
then widget scope property `myAttr` will be `"abc"`.
331
330
332
331
* `evaluate` - one time evaluation of expression stored in the attribute. <br/> Given
333
- `<widget my-attr='name'>` and widget definition of `locals : {myAttr:'evaluate'}`, and
332
+ `<widget my-attr='name'>` and widget definition of `scope : {myAttr:'evaluate'}`, and
334
333
parent scope `{name:'angular'}` then widget scope property `myAttr` will be `"angular"`.
335
334
336
335
* `bind` - Set up one way binding from the element attribute to the widget scope. <br/>
337
- Given `<widget my-attr='{{name}}'>` and widget definition of `locals : {myAttr:'bind'}`,
336
+ Given `<widget my-attr='{{name}}'>` and widget definition of `scope : {myAttr:'bind'}`,
338
337
and parent scope `{name:'angular'}` then widget scope property `myAttr` will be
339
338
`"angular"`, but any changes in the parent scope will be reflected in the widget scope.
340
339
341
340
* `accessor` - Set up getter/setter function for the expression in the widget element
342
341
attribute to the widget scope. <br/> Given `<widget my-attr='name'>` and widget definition
343
- of `locals : {myAttr:'prop'}`, and parent scope `{name:'angular'}` then widget scope
342
+ of `scope : {myAttr:'prop'}`, and parent scope `{name:'angular'}` then widget scope
344
343
property `myAttr` will be a function such that `myAttr()` will return `"angular"` and
345
344
`myAttr('new value')` will update the parent scope `name` property. This is useful for
346
345
treating the element as a data-model for reading/writing.
347
346
348
- * `expression` - Treat element attribute as an expression to be executed in form of an event .
347
+ * `expression` - Treat element attribute as an expression to be executed on the parent scope .
349
348
<br/>
350
- Given `<widget my-attr='doSomething()'>` and widget definition of `locals :
349
+ Given `<widget my-attr='doSomething()'>` and widget definition of `scope :
351
350
{myAttr:'expression'}`, and parent scope `{doSomething:function() {}}` then calling the
352
351
widget scope function `myAttr` will execute the expression against the parent scope.
353
352
@@ -371,7 +370,7 @@ compiler}. The attributes are:
371
370
372
371
373
372
* `inject` (object hash) - Specifies a way to inject bindings into a controller. Injection
374
- definition is a hash of normalized element attribute name to their corresponding binding
373
+ definition is a hash of normalized element attribute names to their corresponding binding
375
374
strategy. Valid binding strategies are:
376
375
377
376
* `attribute` - inject attribute value. <br/>
@@ -421,10 +420,10 @@ compiler}. The attributes are:
421
420
transclusion function which is pre-bound to the correct scope. In a typical setup the widget
422
421
creates an `isolate` scope, but the transclusion is not a child, but a sibling of the `isolate`
423
422
scope. This makes it possible for the widget to have private state, and the transclusion to
424
- be bound to the pre-`isolate` scope.
423
+ be bound to the parent ( pre-`isolate`) scope.
425
424
426
425
* `true` - transclude the content of the directive.
427
- * `element` - transclude the whole element including any directives defined at lower priority.
426
+ * `' element' ` - transclude the whole element including any directives defined at lower priority.
428
427
429
428
430
429
* `compile`: This is the compile function described in the section below.
@@ -569,11 +568,11 @@ This will not render properly, unless we do some scope magic.
569
568
The first issue we have to solve is that the dialog box template expect `title` to be defined, but
570
569
the place of instantiation would like to bind to `username`. Furthermore the buttons expect `onOk`
571
570
as well as `onCancel` functions to be present in the scope. This limits the usefulness of the
572
- widget. To solve the mapping issue we use the `locals` to create local variables which the
573
- template expects as follows
571
+ widget. To solve the mapping issue we use the `locals` to create local variables which the template
572
+ expects as follows:
574
573
575
574
<pre>
576
- locals : {
575
+ scope : {
577
576
title: 'bind', // set up title to accept data-binding
578
577
onOk: 'exp', // create a delegate onOk function
579
578
onCancel: 'exp', // create a delegate onCancel function
0 commit comments