How Route from javascript

I’ve been looking for a way to route to a new vaadin flow page from within javascript.

I’ve found the Router js here:

https://vaadin.github.io/vaadin-router/vaadin-router/#/classes/Vaadin.Router.Location

However I’m unclear if this is the right tooling to do this.

I’ve seen references to a ‘router-link’ tag but I can’t find a library for it and I also get the impression that its only for annotation of <a> tags rather than for general client side routing.

I should note that most of our routing is done server side we just have a couple of specific use cases that require client side routing.

Just to be clear, this is of course a single page app and we don’t want a full page refresh for the normal reasons.

Not sure if this is what you are looking for but if you add <a router-link href="someview"> on the client side, then Flow will capture the event and handle navigation on the server.

The Vaadin Router project is currently not used by Flow in any way and an integration is missing so it will probably not help you, unless you are looking to do offline or some other case where you need routing to take place without the server being available.

I’ve actually tried using <a router-link href="someview"> and I’m getting full page reloads rather than the expected SPA behavour.

Is the router-link dependent on anything?

The router-links are used in a polymer 2 component which I’m using as a view.

The use case I have is actually for a page which must work offline.
Its essentially a web page hosted in a android app. The app needs to force a page transition.
The app is calling into the page via a javascript call from which we then need to force the page transition.

Actually, slight mis-communications internally :<

So it turns out we are actually online.
I’ve just shown my team member how to resolve the issue via a @clientcallable method.

However I’m still interested in my question about getting router-link working.