Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

Commit

Permalink
fix(element binder): Use the new-style Module.bind(toFactory) syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
jbdeboer committed Jul 15, 2014
1 parent 68ba14e commit bed6bcb
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/core_dom/element_binder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ class TemplateElementBinder extends ElementBinder {
_registerViewFactory(node, parentInjector, nodeModule) {
assert(templateViewFactory != null);
nodeModule
..bindByKey(VIEW_PORT_KEY, toFactory: (_) =>
..bindByKey(VIEW_PORT_KEY, inject: const [], toFactory: () =>
new ViewPort(node, parentInjector.getByKey(ANIMATE_KEY)))
..bindByKey(VIEW_FACTORY_KEY, toValue: templateViewFactory)
..bindByKey(BOUND_VIEW_FACTORY_KEY, toFactory: (Injector injector) =>
..bindByKey(BOUND_VIEW_FACTORY_KEY, inject: const [Injector], toFactory: (Injector injector) =>
templateViewFactory.bind(injector));
}
}
Expand Down Expand Up @@ -250,8 +250,8 @@ class ElementBinder {
void _createDirectiveFactories(DirectiveRef ref, nodeModule, node, nodesAttrsDirectives, nodeAttrs,
visibility) {
if (ref.type == TextMustache) {
nodeModule.bind(TextMustache, toFactory: (Injector injector) => new TextMustache(
node, ref.valueAST, injector.getByKey(SCOPE_KEY)));
nodeModule.bind(TextMustache, inject: const [Scope],
toFactory: (Scope scope) => new TextMustache(node, ref.valueAST, scope));
} else if (ref.type == AttrMustache) {
if (nodesAttrsDirectives.isEmpty) {
nodeModule.bind(AttrMustache, toFactory: (Injector injector) {
Expand All @@ -265,7 +265,8 @@ class ElementBinder {
} else if (ref.annotation is Component) {
assert(ref == componentData.ref);

nodeModule.bindByKey(ref.typeKey, toFactory: componentData.factory.call(node), visibility: visibility);
nodeModule.bindByKey(ref.typeKey, inject: const [Injector],
toFactory: componentData.factory.call(node), visibility: visibility);
} else {
nodeModule.bindByKey(ref.typeKey, visibility: visibility);
}
Expand Down Expand Up @@ -297,7 +298,7 @@ class ElementBinder {
..bindByKey(NODE_ATTRS_KEY, toValue: nodeAttrs);

if (_config.elementProbeEnabled) {
nodeModule.bindByKey(ELEMENT_PROBE_KEY, toFactory: (_) => probe);
nodeModule.bindByKey(ELEMENT_PROBE_KEY, inject: const [], toFactory: () => probe);
}

directiveRefs.forEach((DirectiveRef ref) {
Expand Down

0 comments on commit bed6bcb

Please sign in to comment.