Hi all,
I am having some troubles to make a link to an external page working.
In the service, I set my models when the page is loaded:
@Override
protected void onAttach(final AttachEvent event) {
getModel().setActions(getActions());
}
In the HTML template, I use dom-repeat
to display the provided actions:
<template is="dom-repeat" items="[[actions]
]" as="action">
<div>
<div>
<p>[[action.description]
]</p>
</div>
<vaadin-button on-click="get">
<iron-icon icon="lumo:arrow-down"/>
</vaadin-button>
</div>
</template>
To get a callback from the click, In the service I have the following callback:
@EventHandler
private void get(@ModelItem("event.model.action") final ModelAction action) {
// TODO: follow link to http://external-page/id=action.getIdentifier()
}
In this callback, I would like to navigate to http://external-page/id=<action identifier>
. How can this be done?
I am having a hard time to figure this out. The resources I find are either talking about Vaadin v10/v8, or are using Anchor
as available in v12, but I don’t know how I could link a Java Anchor
to a <vaadin-button>
within a dom-repeat
in my HTML page. That said, I am also not sure if I should use an Anchor
at all. Basically, all I want to do is follow a link to an external website.
Thank you!