I’ve just started exploring SPAs and am rather confused about routing.
Creating a single page and injecting content from different partial pages works fine. Where I’m stuck is how to deal with multiple such pages. In each case the main page and the partial page files are stored in a separate folder. As an example, let’s say I have two folders, for ‘links’ and ‘catalogues’, within an admin folder. The test routes currently look like this:
I have a sidebar menu with links to the various pages. If I open one of these page in a browser, from within Wappler, all the links work fine (eg the 3 ‘link’ pages). One of the URLs will be something like:
www.site.com/adm/links/links_list1
The problem is, if I then click on one of the other set of links (eg for catalogues), only the last part of the URL updates, eg:
www.site.com/adm/links/catalog_list1
.
… so the link fails of course (‘links’ is still in the path - whereas it should be ‘catalogs’).
I thought I might be able to get this to work by altering the base URL, but this doesn’t seem to be possible.
Hopefully I’m overlooking something, as I’m sure this must be possible. Or perhaps I will have to restructure things- eg put all the main files in one folder (so they’ll have the same base URL) and split just the related partial files in the current folder structure. I think this would work but hope it’s not the best way. I would be grateful for any advice.
Last updated: