Reputation: 3367
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>
Upvotes: 3
Views: 1798
Reputation: 3200
See the docs here.
What you will want to do is:
<input readonly$="{{my-boolean-expression}}">
Upvotes: 7