@@ -111,6 +111,7 @@ class DirectiveInjector implements DirectiveBinder {
111
111
final Animate _animate;
112
112
final EventHandler _eventHandler;
113
113
Scope scope; //TODO(misko): this should be final after we get rid of controller
114
+ final View _view;
114
115
115
116
NgElement _ngElement;
116
117
ElementProbe _elementProbe;
@@ -144,15 +145,18 @@ class DirectiveInjector implements DirectiveBinder {
144
145
145
146
static Binding _tempBinding = new Binding ();
146
147
147
- DirectiveInjector (this ._parent, appInjector, this ._node, this ._nodeAttrs,
148
- this ._eventHandler, this .scope, this ._animate)
149
- : _appInjector = appInjector;
148
+ DirectiveInjector (DirectiveInjector parent, appInjector, this ._node, this ._nodeAttrs,
149
+ this ._eventHandler, this .scope, this ._animate, [View view])
150
+ : _parent = parent,
151
+ _appInjector = appInjector,
152
+ _view = view == null && parent != null ? parent._view : view;
150
153
151
154
DirectiveInjector ._default (this ._parent, this ._appInjector)
152
155
: _node = null ,
153
156
_nodeAttrs = null ,
154
157
_eventHandler = null ,
155
158
scope = null ,
159
+ _view = null ,
156
160
_animate = null ;
157
161
158
162
void bind (key, {dynamic toValue: DEFAULT_VALUE ,
@@ -295,6 +299,7 @@ class DirectiveInjector implements DirectiveBinder {
295
299
currentInjector = currentInjector._parent;
296
300
}
297
301
return null ;
302
+ case VIEW_KEY_ID : return _view;
298
303
default : new NoProviderError (_KEYS [keyId]);
299
304
}
300
305
}
@@ -375,8 +380,8 @@ class TemplateDirectiveInjector extends DirectiveInjector {
375
380
376
381
TemplateDirectiveInjector (DirectiveInjector parent, Injector appInjector,
377
382
Node node, NodeAttrs nodeAttrs, EventHandler eventHandler,
378
- Scope scope, Animate animate, this ._viewFactory)
379
- : super (parent, appInjector, node, nodeAttrs, eventHandler, scope, animate);
383
+ Scope scope, Animate animate, this ._viewFactory, [ View view] )
384
+ : super (parent, appInjector, node, nodeAttrs, eventHandler, scope, animate, view );
380
385
381
386
382
387
Object _getById (int keyId) {
@@ -400,9 +405,9 @@ class ComponentDirectiveInjector extends DirectiveInjector {
400
405
401
406
ComponentDirectiveInjector (DirectiveInjector parent, Injector appInjector,
402
407
EventHandler eventHandler, Scope scope,
403
- this ._templateLoader, this ._shadowRoot, this ._contentPort)
408
+ this ._templateLoader, this ._shadowRoot, this ._contentPort, [ View view] )
404
409
: super (parent, appInjector, parent._node, parent._nodeAttrs, eventHandler, scope,
405
- parent._animate) {
410
+ parent._animate, view ) {
406
411
// A single component creates a ComponentDirectiveInjector and its DirectiveInjector parent,
407
412
// so parent should never be null.
408
413
assert (parent != null );
0 commit comments