@@ -158,7 +158,9 @@ class BlockFactory {
158
158
TemplateCache templateCache = injector.get (TemplateCache );
159
159
DirectiveMap directives = injector.get (DirectiveMap );
160
160
// This is a bit of a hack since we are returning different type then we are.
161
- var componentFactory = new _ComponentFactory (node, ref.type, ref.annotation as NgComponent , injector.get (dom.NodeTreeSanitizer ));
161
+ var componentFactory = new _ComponentFactory (node, ref.type,
162
+ ref.annotation as NgComponent ,
163
+ injector.get (dom.NodeTreeSanitizer ), _expando);
162
164
if (fctrs == null ) fctrs = new Map <Type , _ComponentFactory >();
163
165
fctrs[ref.type] = componentFactory;
164
166
return componentFactory.call (injector, compiler, scope, blockCache, http, templateCache, directives);
@@ -177,11 +179,14 @@ class BlockFactory {
177
179
boundBlockFactory = (Injector injector) => ref.blockFactory.bind (injector);
178
180
}
179
181
});
180
- nodeModule.factory (BlockHole , blockHoleFactory);
181
- nodeModule.factory (BlockFactory , blockFactory);
182
- nodeModule.factory (BoundBlockFactory , boundBlockFactory);
182
+ nodeModule
183
+ ..factory (BlockHole , blockHoleFactory)
184
+ ..factory (BlockFactory , blockFactory)
185
+ ..factory (BoundBlockFactory , boundBlockFactory)
186
+ ..factory (ElementProbe , (_) => probe);
183
187
nodeInjector = parentInjector.createChild ([nodeModule]);
184
- probe = _expando[node] = new ElementProbe (node, nodeInjector, scope);
188
+ probe = _expando[node] = new ElementProbe (
189
+ parentInjector.get (ElementProbe ), node, nodeInjector, scope);
185
190
} finally {
186
191
assert (_perf.stopTimer (timerId) != false );
187
192
}
@@ -314,14 +319,16 @@ class _ComponentFactory {
314
319
final Type type;
315
320
final NgComponent component;
316
321
final dom.NodeTreeSanitizer treeSanitizer;
322
+ final Expando _expando;
317
323
318
324
dom.ShadowRoot shadowDom;
319
325
Scope shadowScope;
320
326
Injector shadowInjector;
321
327
Compiler compiler;
322
328
var controller;
323
329
324
- _ComponentFactory (this .element, this .type, this .component, this .treeSanitizer);
330
+ _ComponentFactory (this .element, this .type, this .component, this .treeSanitizer,
331
+ this ._expando);
325
332
326
333
dynamic call (Injector injector, Compiler compiler, Scope scope, BlockCache $blockCache, Http $http, TemplateCache $templateCache, DirectiveMap directives) {
327
334
this .compiler = compiler;
@@ -380,12 +387,16 @@ class _ComponentFactory {
380
387
}
381
388
382
389
createShadowInjector (injector, TemplateLoader templateLoader) {
390
+ var probe;
383
391
var shadowModule = new Module ()
384
392
..type (type)
385
393
..value (Scope , shadowScope)
386
394
..value (TemplateLoader , templateLoader)
387
- ..value (dom.ShadowRoot , shadowDom);
395
+ ..value (dom.ShadowRoot , shadowDom)
396
+ ..factory (ElementProbe , (_) => probe);
388
397
shadowInjector = injector.createChild ([shadowModule], name: _SHADOW );
398
+ probe = _expando[shadowDom] = new ElementProbe (
399
+ injector.get (ElementProbe ), shadowDom, shadowInjector, shadowScope);
389
400
return shadowInjector;
390
401
}
391
402
}
@@ -429,10 +440,11 @@ String _html(obj) {
429
440
* SEE: [ngInjector] , [ngScope] , [ngDirectives]
430
441
*/
431
442
class ElementProbe {
443
+ final ElementProbe parent;
432
444
final dom.Node element;
433
445
final Injector injector;
434
446
final Scope scope;
435
447
final directives = [];
436
448
437
- ElementProbe (this .element, this .injector, this .scope);
449
+ ElementProbe (this .parent, this . element, this .injector, this .scope);
438
450
}
0 commit comments