Hi Diego,
First of all, thank you for your response and for the docs link that helped me understanding better the concepts.
Unfortunately it is not the issue you mention above, I specify the slot when I want to place content. Let me give you more details.
I have a parent-layout with the following definition:
<template>
<div class="title" hidden$="{{toggleTitle}}">Title</div>
<vaadin-button id="toggleTitleButon" on-click="_toggleTitle" theme="raised tertiary">Toggle Title</vaadin-button>
<div>
<slot name="firstSlot"></slot>
</div>
<div>
<slot name="secondSlot"></slot>
</div>
</template>
What I tried was to define a view, let’s call it example-template with the following Java class and Polymer template:
@Tag("example-template")
@HtmlImport("src/example-template.html")
@Route(value = "example", layout = ParentLayout.class)
public class ExampleTemplate extends PolymerTemplate<ExampleTemplate.ExampleModel> {
....
}
<template>
<div slot="firstSlot">First slot - example template</div>
<div slot="secondSlot">Second slot - example template</div>
</template>
In this case, my expectation was to see the texts from example-template displayed on the screen, on the afferent slots but it doesn’t happen.
If I remove layout = ParentLayout.class from ExampleTemplate class and I update the template as below, it works as expected.
<template>
<parent-layout>
<div slot="firstSlot">First slot - example template</div>
<div slot="secondSlot">Second slot - example template</div>
</parent-layout>
</template>
Unfortunately, this second approach has a disadvantage, it doesn’t keep the state of the ParentLayout when navigating between different routes.
Do you have any suggestion ?
Thanks,
Silvestru