aurelia-router-metadata
Metadata extension for aurelia-router aimed at simplifying router configuration and providing "eager loading" capabilities.
The @routeConfig({...})
and @configureRouter([...])
decorators largely eliminate the need for configureRouter()
and make configuration a bit more like the [Route()] attributes in ASP.NET.
NEW SINCE 0.9: Static code analysis and smart autoconfiguration. See the demo app pages for example config combinations that work.
This is enabled by default. It can be disabled in the settings (see below).
View a LIVE DEMO
Installation
Install the npm dependency via
npm i aurelia-router-metadata
or via the Aurelia CLI
au install aurelia-router-metadata
If you are using webpack, no additional steps are required. Simply import a decorator and it will work.
Aurelia-CLI
For Aurelia-CLI projects based on RequireJS or SystemJS, the following will install and declare the dependency in your aurelia.json:
au install aurelia-router-metadata
or if you have already installed and only need to add the dependency to aurelia.json:
au import aurelia-router-metadata
alternatively you can manually add the dependency to your vendor.bundles:
"dependencies":
Configuration
IMPORTANT: as of version 0.9, configuring the plugin via FrameworkConfiguration is mandatory
;;
Usage
- With decorators
; // Make sure to wrap these in `PLATFORM.moduleName` when using webpack ... ... ... ;
- Without decorators
- Combined
Building a navigation menu
Conceptually:
nav-menu.html
${route.title}
For a working example see the live demo
Feedback
It's still in early development and needs more testing and feedback.
Feel free to reach out with any questions/issues/suggestions :)
Building The Code
- From the project folder, execute the following command:
yarn/npm install
- To build the code:
npm run build
Running The Tests
- To run the tests
npm run test
- To continuously run the tests
npm run develop