So, I try to make something like this
some-element.js
<dom-repeat items="${cards}" as="item">
<template>
<dom-if if="${_isRoyal(item.type)}">
<template>
<p>The card is a Royal card!<p>
</template>
</dom-if>
<template>
<dom-repeat>
...
_isActive(e) {
console.log(e);
}
...
when I do that, the item inside <dom-if if="${_isRoyal(item.type)}"> is not defined.
and when I do this:
<dom-if if="[[_isRoyal(item.label)]]">
for the conditional part, console says that method '_isRoyal' not defined.
any help with this? thanks.
<dom-if> and <dom-repeat> are Polymer-specific concepts, not applicable to lit-html. Instead, use regular JavaScript statements to achieve the same. For example, instead of <dom-if>, use an if-statement. Instead of <dom-repeat>, you can use repeat. For more information, see https://polymer.github.io/lit-html/guide/writing-templates.html#conditionals-ifs-and-loops
that was helping. thanks a lot.
I'm figuring this out too, thanks.
Most helpful comment
<dom-if>and<dom-repeat>are Polymer-specific concepts, not applicable tolit-html. Instead, use regular JavaScript statements to achieve the same. For example, instead of<dom-if>, use anif-statement. Instead of<dom-repeat>, you can userepeat. For more information, see https://polymer.github.io/lit-html/guide/writing-templates.html#conditionals-ifs-and-loops