You will need to add the isValidConfig property to your Template Model in order to pass it from the server to the client. For example like this: example-template.html:
<dom-module id="example-template">
<template>
<span>[[value]
]</span>
<template is="dom-if" if="[[isValidConfig]
]">
foo
</template>
<template is="dom-if" if="[[!isValidConfig]
]">
bar
</template>
</template>
<!-- Polymer boilerplate to register the example-template element -->
<script>
class ExampleTemplate extends Polymer.Element {
static get is() {
return 'example-template'
}
}
customElements.define(ExampleTemplate.is, ExampleTemplate);
</script>
</dom-module>
ExampleTemplate.java:
@Tag("example-template")
@HtmlImport("src/example-template.html")
public class ExampleTemplate extends PolymerTemplate<ExampleModel> {
public ExampleTemplate() {
// Set the initial value to the "value" property.
getModel().setValue("Shown inside <span>");
getModel().setIsValidConfig(false);
}
public void setValue(String value) {
getModel().setValue(value);
}
public void setIsValidConfig(boolean isValidConfig) {
getModel().setIsValidConfig(isValidConfig);
}
public interface ExampleModel extends TemplateModel {
void setValue(String value);
void setIsValidConfig(boolean isValidConfig);
}
}