Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conditional attributes in 1.0

Is it possible to use conditional attributes in Polymer 1.0? I've try to find it in the migration guide and also in Road to polymer without success.

I know that in Polymer 1.0 there's a new conditional template, but I don't want to duplicate my code.

So in 0.5 version we can had something like:

<input readonly?={{my-boolean-expression}} (...)>

And, in 1.0, should we do it with a template?

<template is="dom-if" if="{{my-boolean-expression}}">
      <input readonly (...)>
</template>
<template is="dom-if" if="!{{my-boolean-expression}}">
       <input (...)>
</template>
like image 345
Mario Levrero Avatar asked Dec 13 '25 23:12

Mario Levrero


1 Answers

See the docs here.

What you will want to do is:

<input readonly$="{{my-boolean-expression}}">
like image 52
Ben Thomas Avatar answered Dec 16 '25 23:12

Ben Thomas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!