sounakpal
sounakpal

Reputation: 106

Polymer 1.0 Dom-if check with attribute

I want to show template according to the attribute passed in the element.

Say

 <template>
    <template is="dom-if" if="[[!multiLine]]">
        ..
    </template>
    <template is="dom-if" if="[[multiLine]]">
        ..
    </template>
</template>

in properties I pass

properties:{
   multiLine: {
        type: Boolean,
        value: false
    }
}

and in the html I can only pass multi-line as attribute. How can I achieve this? Its always going in the first one.

Upvotes: 0

Views: 891

Answers (1)

Neil John Ramal
Neil John Ramal

Reputation: 3734

If you add the multi-line attribute in the element outside of a dom-bind template, it would always evaluate to true, regardless of the value you passed, though you can set it to false by not adding the attribute at all on the element or by setting it with a falsy value in js.

Upvotes: 1

Related Questions