Francesco Scala
Francesco Scala

Reputation: 301

Importing template vaadin lose java code reference

I have a JsModule in my vaadin project, so I want to add to my page another, I made this so:

<div><products-search id="products-search"></products-search></div>

It works but there is a problem, the template products-search is related to a java class, if I access directly the page products-search the java binding works, but including the page in another in this way it works partially indeed the layout is visibile but doesn't work the interaction with the java code!

Someone can help me?

Upvotes: 0

Views: 48

Answers (1)

ollitietavainen
ollitietavainen

Reputation: 4275

If you're importing a custom JS module to your template, the JavaScript code won't know anything about the imported web component's Java companion class. You'll need another approach - you could use @Id binding instead or add a <slot> in your template and append the corresponding Java component on the server.

Upvotes: 1

Related Questions