Polymer Expressions supports true and false as well as numbers and strings.

https://github.com/Polymer/polymer-expressions/tree/master/third_party/esprima

So if `if="{{true}}"` is not working that is a bug.


On Sat, Mar 22, 2014 at 3:52 PM, Arthur Evans <[email protected]> wrote:

> My apologies, apparently I just didn't try enough things... or RTFM. This
> works as expected:
>
>          <ul>
>           <template repeat="{{s in salutations}}"  if="{{
> salutations.length }}">
>             <li>{{s.what}}: <input type="text" value="{{s.who}}"></li>
>           </template>
>         </ul>
>
> I tried  if="{{ true }}" at first. Then I checked the expressions doc and
> realized that "true/false" weren't listed as accepted literals.
>
> However, I also found that  if="{{ 1 }}" didn't evaluate as truthy, but
> if="{{ 1 == 1 }}" did. That seems like a hiccup in the expression library
> (but it might be just another gap in my understanding).
>
> Having a separate variable, this.showSaluations and using
> if="{{showSalutations}}" also worked as expected.
>
> My other confusions apparently related to my not getting the scoping
> correct. Fixed that.
>
> Thanks,
> Arthur
>
>
> On Sat, Mar 22, 2014 at 12:04 PM, Scott Miles <[email protected]> wrote:
>
>> >> However, things work a bit differently inside a Polymer element
>>
>> Can you spell this out? What have you tried?
>>
>>
>>
>>
>> On Sat, Mar 22, 2014 at 12:00 PM, Arthur Evans <[email protected]>wrote:
>>
>>> Hi folks,
>>>
>>> I'm curious about the use of template binding with the `repeat if`
>>> syntax. This is documented in the template binding library:
>>>
>>> http://www.polymer-project.org/docs/polymer/template.html
>>>
>>> <template repeat if="{{ conditionalValue }}">
>>>   Repeat if and only if conditionalValue is truthy.</template>However, 
>>> things work a bit differently inside a Polymer element, and I haven't been 
>>> able to get this form to work. Does anyone know if `repeat if` works inside 
>>> a Polymer element?
>>>
>>> Thanks,
>>> Arthur
>>>
>>>  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 [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/polymer-dev/CADSbU_x4PoEL4bN9VjnvztPG3phASZ6GSG%3D%3Dsg7DBXRzzEWjpA%40mail.gmail.com<https://groups.google.com/d/msgid/polymer-dev/CADSbU_x4PoEL4bN9VjnvztPG3phASZ6GSG%3D%3Dsg7DBXRzzEWjpA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>  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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/polymer-dev/CADSbU_ym0EWwnchmAnvfdHumRvYh9cO411V66qtT-rHMqTLGXg%40mail.gmail.com<https://groups.google.com/d/msgid/polymer-dev/CADSbU_ym0EWwnchmAnvfdHumRvYh9cO411V66qtT-rHMqTLGXg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
erik

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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/polymer-dev/CAJ8%2BGoiLio1Ra9L2Bto%2BXXRW%2BvJr_8VVyqAHaUpOF%2BZZdJ76mQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to