@@ -27,10 +27,10 @@ class TemplateElementBinder extends ElementBinder {
2727 _registerViewFactory (node, parentInjector, nodeModule) {
2828 assert (templateViewFactory != null );
2929 nodeModule
30- ..bind ( ViewPort , toFactory: (_) =>
31- new ViewPort (node, parentInjector.get ( Animate )))
32- ..bind ( ViewFactory , toValue: templateViewFactory)
33- ..bind ( BoundViewFactory , toFactory: (Injector injector) =>
30+ ..bindByKey ( _VIEW_PORT_KEY , toFactory: (_) =>
31+ new ViewPort (node, parentInjector.getByKey ( _ANIMATE_KEY )))
32+ ..bindByKey ( _VIEW_FACTORY_KEY , toValue: templateViewFactory)
33+ ..bindByKey ( _BOUND_VIEW_FACTORY_KEY , toFactory: (Injector injector) =>
3434 templateViewFactory.bind (injector));
3535 }
3636}
@@ -203,7 +203,7 @@ class ElementBinder {
203203
204204 void _link (nodeInjector, probe, scope, nodeAttrs, formatters) {
205205 _usableDirectiveRefs.forEach ((DirectiveRef ref) {
206- var directive = nodeInjector.get (ref.type );
206+ var directive = nodeInjector.getByKey (ref.typeKey );
207207 probe.directives.add (directive);
208208
209209 if (ref.annotation is Controller ) {
@@ -240,18 +240,18 @@ class ElementBinder {
240240 void _createDirectiveFactories (DirectiveRef ref, nodeModule, node, nodesAttrsDirectives, nodeAttrs,
241241 visibility) {
242242 if (ref.type == TextMustache ) {
243- nodeModule.bind ( TextMustache , toFactory: (Injector injector) {
244- return new TextMustache (node, ref.value, injector.get ( Interpolate ),
245- injector.get ( Scope ), injector.get ( FormatterMap ));
243+ nodeModule.bindByKey ( _TEXT_MUSTACHE_KEY , toFactory: (Injector injector) {
244+ return new TextMustache (node, ref.value, injector.getByKey ( _INTERPOLATE_KEY ),
245+ injector.getByKey ( _SCOPE_KEY ), injector.getByKey ( _FORMATTER_MAP_KEY ));
246246 });
247247 } else if (ref.type == AttrMustache ) {
248248 if (nodesAttrsDirectives.isEmpty) {
249249 nodeModule.bind (AttrMustache , toFactory: (Injector injector) {
250- var scope = injector.get ( Scope );
251- var interpolate = injector.get ( Interpolate );
250+ var scope = injector.getByKey ( _SCOPE_KEY );
251+ var interpolate = injector.getByKey ( _INTERPOLATE_KEY );
252252 for (var ref in nodesAttrsDirectives) {
253253 new AttrMustache (nodeAttrs, ref.value, interpolate, scope,
254- injector.get ( FormatterMap ));
254+ injector.getByKey ( _FORMATTER_MAP_KEY ));
255255 }
256256 });
257257 }
@@ -266,23 +266,24 @@ class ElementBinder {
266266 } else {
267267 factory = _componentFactory;
268268 }
269- nodeModule.bind (ref.type , toFactory: factory .call (node, ref), visibility: visibility);
269+ nodeModule.bindByKey (ref.typeKey , toFactory: factory .call (node, ref), visibility: visibility);
270270 } else {
271- nodeModule.bind (ref.type , visibility: visibility);
271+ nodeModule.bindByKey (ref.typeKey , visibility: visibility);
272272 }
273273 }
274274
275275 // Overridden in TemplateElementBinder
276276 void _registerViewFactory (node, parentInjector, nodeModule) {
277- nodeModule..bind ( ViewPort , toValue: null )
278- ..bind ( ViewFactory , toValue: null )
279- ..bind ( BoundViewFactory , toValue: null );
277+ nodeModule..bindByKey ( _VIEW_PORT_KEY , toValue: null )
278+ ..bindByKey ( _VIEW_FACTORY_KEY , toValue: null )
279+ ..bindByKey ( _BOUND_VIEW_FACTORY_KEY , toValue: null );
280280 }
281281
282+
282283 Injector bind (View view, Injector parentInjector, dom.Node node) {
283284 Injector nodeInjector;
284- Scope scope = parentInjector.get ( Scope );
285- FormatterMap formatters = parentInjector.get ( FormatterMap );
285+ Scope scope = parentInjector.getByKey ( _SCOPE_KEY );
286+ FormatterMap formatters = parentInjector.getByKey ( _FORMATTER_MAP_KEY );
286287 var nodeAttrs = node is dom.Element ? new NodeAttrs (node) : null ;
287288 ElementProbe probe;
288289
@@ -291,12 +292,12 @@ class ElementBinder {
291292
292293 var nodesAttrsDirectives = [];
293294 var nodeModule = new Module ()
294- ..bind ( NgElement )
295- ..bind ( View , toValue: view)
296- ..bind (dom. Element , toValue: node)
297- ..bind (dom. Node , toValue: node)
298- ..bind ( NodeAttrs , toValue: nodeAttrs)
299- ..bind ( ElementProbe , toFactory: (_) => probe);
295+ ..bindByKey ( _NG_ELEMENT_KEY )
296+ ..bindByKey ( _VIEW_KEY , toValue: view)
297+ ..bindByKey ( _ELEMENT_KEY , toValue: node)
298+ ..bindByKey ( _NODE_KEY , toValue: node)
299+ ..bindByKey ( _NODE_ATTRS_KEY , toValue: nodeAttrs)
300+ ..bindByKey ( _ELEMENT_PROBE_KEY , toFactory: (_) => probe);
300301
301302 directiveRefs.forEach ((DirectiveRef ref) {
302303 Directive annotation = ref.annotation;
@@ -317,7 +318,7 @@ class ElementBinder {
317318
318319 nodeInjector = parentInjector.createChild ([nodeModule]);
319320 probe = _expando[node] = new ElementProbe (
320- parentInjector.get ( ElementProbe ), node, nodeInjector, scope);
321+ parentInjector.getByKey ( _ELEMENT_PROBE_KEY ), node, nodeInjector, scope);
321322
322323 _link (nodeInjector, probe, scope, nodeAttrs, formatters);
323324
0 commit comments