1 Reply Latest reply on Jun 2, 2015 3:40 PM by ddadlani

    Errai and Polymer 1.0 and databinding

    hr.stoyanov

      Hi all,

      I was looking at code snippets from the just-released Polymer 1.0: https://www.polymer-project.org/1.0/docs/devguide/data-binding.html

      ...

      <dom-module id="host-element">
        
      <template>
        
      <child-element name="{{myName}}"></child-element> 
        
      </template>
      </dom-module>

      ...


      As you can see they use double moustache {{}}  for automatic binding and double square brackets [[]] for one-way binding. This is similar to AngulaJS and other frameworks.

      In Errai, data binding uses "data-field" attribute and a few hard rules. My questions/suggestions are:

      1. Can Errai adopt the {{{}} and [[]] style data binding as several frameworks are leaning this way, in addition to data-field?

      2. How can one bind data to element attributes in Errai, something like: <div  data-whatever="{{com.my.JavaBean.whatever}}">...</div> ? I have not see a nice way to link data to element attributes in Errai.

      3. Does the Errai team plan on releasing a demo with Polymer 1.0? I know there were some blogs with earlier versions of Polymer, but Bootstrap is so yesterday ...


      Thanks.

        • 1. Re: Errai and Polymer 1.0 and databinding
          ddadlani

          Hello Hristo,

           

          Errai UI intentionally keeps all the binding logic in the Java code to allow users to use pure HTML templates for their widgets. You can also use the 'id' or 'class' attributes of your HTML template instead of the 'data-field' attribute.


          As for Polymer, we are currently working on a demo integrating web components with Errai.

           

          Cheers,
          Divya