@@ -68,30 +68,11 @@ abstract class Directive {
68
68
* Specifies the compiler action to be taken on the child nodes of the
69
69
* element which this currently being compiled. The values are:
70
70
*
71
- * * [COMPILE_CHILDREN] (* default* )
72
- * * [TRANSCLUDE_CHILDREN]
73
- * * [IGNORE_CHILDREN]
71
+ * * [:true:] Compile the child nodes of the element. ( default)
72
+ * * [:false:] Do not compile/visit the child nodes. Angular markup on
73
+ * descendant nodes will not be processed.
74
74
*/
75
- @deprecated
76
- final String children;
77
-
78
- /**
79
- * Compile the child nodes of the element. This is the default.
80
- */
81
- @deprecated
82
- static const String COMPILE_CHILDREN = 'compile' ;
83
- /**
84
- * Compile the child nodes for transclusion and makes available
85
- * [BoundViewFactory] , [ViewFactory] and [ViewPort] for injection.
86
- */
87
- @deprecated
88
- static const String TRANSCLUDE_CHILDREN = 'transclude' ;
89
- /**
90
- * Do not compile/visit the child nodes. Angular markup on descendant nodes
91
- * will not be processed.
92
- */
93
- @deprecated
94
- static const String IGNORE_CHILDREN = 'ignore' ;
75
+ final bool compileChildren;
95
76
96
77
/**
97
78
* A directive/component controller class can be injected into other
@@ -214,18 +195,19 @@ abstract class Directive {
214
195
215
196
const Directive ({
216
197
this .selector,
217
- this .children : Directive . COMPILE_CHILDREN ,
198
+ this .compileChildren : true ,
218
199
this .visibility: Directive .LOCAL_VISIBILITY ,
219
200
this .module,
220
201
this .map: const {},
221
202
this .exportExpressions: const [],
222
203
this .exportExpressionAttrs: const []
223
204
});
224
205
225
- toString () => selector;
226
- get hashCode => selector.hashCode;
227
- operator == (other) =>
228
- other is Directive && selector == other.selector;
206
+ String toString () => selector;
207
+
208
+ int get hashCode => selector.hashCode;
209
+
210
+ bool operator == (other) => other is Directive && selector == other.selector;
229
211
230
212
Directive _cloneWithNewMap (newMap);
231
213
}
@@ -332,7 +314,7 @@ class Component extends Directive {
332
314
_applyAuthorStyles = applyAuthorStyles,
333
315
_resetStyleInheritance = resetStyleInheritance,
334
316
super (selector: selector,
335
- children : Directive . COMPILE_CHILDREN ,
317
+ compileChildren : true ,
336
318
visibility: visibility,
337
319
map: map,
338
320
module: module,
@@ -343,7 +325,7 @@ class Component extends Directive {
343
325
const [] :
344
326
_cssUrls is List ? _cssUrls : [_cssUrls];
345
327
346
- Directive _cloneWithNewMap (newMap) =>
328
+ Component _cloneWithNewMap (newMap) =>
347
329
new Component (
348
330
template: template,
349
331
templateUrl: templateUrl,
@@ -374,24 +356,24 @@ class Component extends Directive {
374
356
* * `detach()` - Called on when owning scope is destroyed.
375
357
*/
376
358
class Decorator extends Directive {
377
- const Decorator ({children : Directive . COMPILE_CHILDREN ,
359
+ const Decorator ({compileChildren : true ,
378
360
map,
379
361
selector,
380
362
module,
381
363
visibility,
382
364
exportExpressions,
383
365
exportExpressionAttrs})
384
366
: super (selector: selector,
385
- children : children ,
367
+ compileChildren : compileChildren ,
386
368
visibility: visibility,
387
369
map: map,
388
370
module: module,
389
371
exportExpressions: exportExpressions,
390
372
exportExpressionAttrs: exportExpressionAttrs);
391
373
392
- Directive _cloneWithNewMap (newMap) =>
374
+ Decorator _cloneWithNewMap (newMap) =>
393
375
new Decorator (
394
- children : children ,
376
+ compileChildren : compileChildren ,
395
377
map: newMap,
396
378
module: module,
397
379
selector: selector,
@@ -400,6 +382,45 @@ class Decorator extends Directive {
400
382
exportExpressionAttrs: exportExpressionAttrs);
401
383
}
402
384
385
+
386
+
387
+ /**
388
+ * Meta-data marker placed on a class which should act as template.
389
+ *
390
+ * Angular templates are instantiated using dependency injection, and can
391
+ * ask for any injectable object in their constructor. Templates can also ask
392
+ * for other components or directives declared on the DOM element.
393
+ *
394
+ * Templates can implement [NgAttachAware] , [NgDetachAware] and declare these
395
+ * optional methods:
396
+ *
397
+ * * `attach()` - Called on first [Scope.apply()] .
398
+ * * `detach()` - Called on when owning scope is destroyed.
399
+ */
400
+ class Template extends Directive {
401
+ const Template ({map,
402
+ selector,
403
+ module,
404
+ visibility,
405
+ exportExpressions,
406
+ exportExpressionAttrs})
407
+ : super (selector: selector,
408
+ compileChildren: true ,
409
+ visibility: visibility,
410
+ map: map,
411
+ module: module,
412
+ exportExpressions: exportExpressions,
413
+ exportExpressionAttrs: exportExpressionAttrs);
414
+
415
+ Template _cloneWithNewMap (newMap) =>
416
+ new Template (map: newMap,
417
+ module: module,
418
+ selector: selector,
419
+ visibility: visibility,
420
+ exportExpressions: exportExpressions,
421
+ exportExpressionAttrs: exportExpressionAttrs);
422
+ }
423
+
403
424
/**
404
425
* Meta-data marker placed on a class which should act as a controller for your
405
426
* application.
@@ -427,7 +448,7 @@ class Controller extends Decorator {
427
448
final String publishAs;
428
449
429
450
const Controller ({
430
- children : Directive . COMPILE_CHILDREN ,
451
+ compileChildren : true ,
431
452
this .publishAs,
432
453
map,
433
454
module,
@@ -437,7 +458,7 @@ class Controller extends Decorator {
437
458
exportExpressionAttrs
438
459
})
439
460
: super (selector: selector,
440
- children : children ,
461
+ compileChildren : compileChildren ,
441
462
visibility: visibility,
442
463
map: map,
443
464
module: module,
@@ -446,7 +467,7 @@ class Controller extends Decorator {
446
467
447
468
Directive _cloneWithNewMap (newMap) =>
448
469
new Controller (
449
- children : children ,
470
+ compileChildren : compileChildren ,
450
471
publishAs: publishAs,
451
472
module: module,
452
473
map: newMap,
0 commit comments