Hi, I am trying out an Aurelia2 app. Its part of a larger web application and is loaded on a sub page with url ‘/members/’.
I cant figure out how to configure the Router to ignore the base /memeber/ part. In Aurelia v1 i would set config.options.root in the configureRouter method. There does not seem to be any equivalent in v2. I’ve tried setting the tag in the html, that does not help.
I could configure /members/ as a dummy parent route as a workaround, but maybe there is a better way?
There will be a configuration option in au2 as well, but it’s not there yet. In the meantime, you can try adding <base href="/members"> to the head of your index.html and change your file called main into
Does this still work? Looks like the latest version of Aurelia (2.0.0-alpha.2) does not contain this functionality within the router. Any suggestions on what to try instead?
Also stuck on this issue. Want to put my app in a subfolder and have configured webpack to change baseurl when building but can’t figure out how to get the routing to not throw a 'X did not match any configured route or registered component name ’ when not run in the root directory.
Are you using Aurelia2 ? I went back to Aurelia v1 because there were other bits missing that I needed. I can show you how to configure it in V1 if you are using it, I don’t know what the status is in the current V2 though.
Thanks. For this specific project I just started it and its currently pretty limited in scope so I went with Aurelia 2 to learn the new framework. I have a pretty big existing application written in Aurelia v1 so I’m well familiar with that version.
Regarding your issues, this router deals with base path automatically. Simply provide a <base href="/path/"> in your index html and the router will respect it.
Please contact me if there are any issues or questions, either here or on Discord!
aurelia-direct-router has more features, primarily regarding direct routing and viewports, and some parts of the api differs a bit. The differences will be documented as soon as possible.
Just doing load="blah" should work. If it doesn’t, please share your route configuration and/or ping me on Discord.
The aurelia-direct-router has more features, primarily regarding direct routing and viewports, and some parts of the api differs a bit. The differences will be documented as soon as possible.
Just doing load="blah" should work. If it doesn’t, please share your route configuration and/or ping me on Discord.
and they are all working for me. Is it possible the package lock file wasn’t deleted? Could you look into the newly created package lock file and see if you can find the @aurelia/metadata version conflict in there?
Sorry I couldn’t give you better help. As a small comfort, this generated conflict error is scheduled to be removed with the next Aurelia release.
Feel free to contact me on Discord once you’ve had a look at your package lock file.
When you’re using the load attribute, the generated href is actually not used so the link should still work. Does it?
There’s a small overhaul to the href generation planned, but for now I’ve made a new release of aurelia-direct-router that prefixes with hashes if fragment hash is used. I hope this solves things for now. If not, let me know.
There’s an api coming shortly to query the router for configured routes from within a context (view model/custom element). Until that’s in place, you can get the configured routes for a specific custom element type by doing
import { Routes } from 'aurelia-direct-router';
...
Routes.getConfiguration(MyApp);
Thank you for support!
I got it working by coincident and then investigated what the difference was in order to try to pay back a bit with giving details that might help going forward.
I’m not into the details of npm and package-lock.json so this might make sense but for me it looks a bit weird. Starting from no node_modules installed, no package-lock.json and the following dependency
“dependencies”: {
“aurelia”: “^2.0.0-alpha.2”,
},
there is a difference to the package-lock.json if I do
npm i aurelia-direct-router
npm i
or
npm i
npm i aurelia-direct-router
The first works, the second doesn’t. The second approach adds a bunch of dependencies which I guess is then the reason for the conflict