0

This question is a follow up question to this question. After upgrading to polymer 0.8.7 the following code stopped working:

  DocumentFragment instanceTemplate(Element template) =>
      template.createInstance(this,
          new PolymerExpressions(globals: {
            'splitnewline': (String input) => input.split("\n")
          }));

Looks like Element doesn't contain a method createInstance anymore. How can I register a own polymer expression in polymer 0.8.7?

PS: I also used the method job() in the past, does anybody know where I can find it now?

Community
  • 1
  • 1
Fox32
  • 13,126
  • 9
  • 50
  • 71

1 Answers1

1

With polymer 0.8.7 you have to import an additional package and call templateBind on the element.

import 'package:template_binding/template_binding.dart';

// ... fancy code in between ...

DocumentFragment instanceTemplate(Element template) =>
  templateBind(template).createInstance(this,
      new PolymerExpressions(globals: {
        'splitnewline': (String input) => input.split("\n")
      }));

Don't know about the job() method though.

Dennis Kaselow
  • 4,351
  • 1
  • 19
  • 18