polymer dart input binding int properties

前端 未结 3 1552
眼角桃花
眼角桃花 2021-01-07 12:02

What is the proper way of binding an input field to an int property on an object (e.g. input box changes and updates int property of an object causing another element who is

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-07 12:05

    I think the answer above is the right way, but I am using this instead of the Transformer:

    class MyPolymerExpressions extends PolymerExpressions {
      MyPolymerExpressions(): super(globals: {
          'intToString': (int input) => '$input',
      });
    
      @override
      prepareBinding(String path, name, node) => Polymer.prepareBinding(path, name, node, super.prepareBinding);
    }
    

    and add this line in de calc.dart :

    @override PolymerExpressions syntax = new MyPolymerExpressions();
    

    Note: in order to use PolymerExpressions, you need:

    import 'package:polymer_expressions/polymer_expressions.dart';
    

提交回复
热议问题