String concatenation is not supported inside a tag, and the tag can’t contain any whitespace:

43 views
Skip to first unread message

toduu

unread,
Sep 20, 2015, 4:24:08 PM9/20/15
to Polymer
String concatenation is not supported inside a tag, and the tag can’t contain any whitespace.   This limitation is hampering.

The moment you do auto format in an ide like eclipse the whole thing gets messed up because spaces get inserted.  

All the function writing one has to do to overcome this limitation also adds more javascript to the code.

Also I was unable to pass data binding to a function.

e.g.  I have a iron-list with items which are paper-cards that have paper-button  .   While setting id based on a function works passing it to another function validate fails ...  

Any suggestions?

<iron-list id="alist" as="item" indexAs="index" auto>
<template>
<a-card que="[[item]]" index="[[index]]"></a-card>

</template>

</iron-list>


<dom-module id="a-card">

...

<paper-card >

   <div  class="card-content">

    <paper-button raised id="{{_ans('W',que)}}" on-click="validate({{_ans('W',que)}})">

..

<paper-card >

    <script>

       Polymer({

           is : 'a-card',

           properties : {

               que : Object

           },

           _ans : function(ans, que) {

               return 'xx_' + ans + que.queNum;

           }


        });


        function validate(option) {

           console.log(option);

       };




























    </script>





Daniel Freedman

unread,
Sep 21, 2015, 2:12:40 PM9/21/15
to toduu, Polymer
Arguments to functions in data-binding must be the names of data-bound properties: https://www.polymer-project.org/1.0/docs/devguide/data-binding.html#annotated-computed

I'd also suggest not trying to change the id or on-click bindings like that, but instead place a new attribute on paper-button with your computed binding.
Then the "validate" function can be a lot simpler: http://jsbin.com/baxucesusa/edit?html,console,output

Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/a8b38417-1728-4544-a39a-f17d45f2adda%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages