Skip to content

Instantly share code, notes, and snippets.

@SaucyJack
Last active August 1, 2017 20:22
Show Gist options
  • Save SaucyJack/c1a14b38d53c1f3e1fc379a31315f172 to your computer and use it in GitHub Desktop.
Save SaucyJack/c1a14b38d53c1f3e1fc379a31315f172 to your computer and use it in GitHub Desktop.
JSON Routes
<template>
<nav>
<ul>
<li repeat.for="x of router.navigation">
<a href.bind="x.href">${x.title}</a>
</li>
</ul>
</nav>
<router-view></router-view>
</template>
import { autoinject} from 'aurelia-dependency-injection';
import { Router, RouterConfiguration } from 'aurelia-router';
export class App {
router;
constructor() {
}
configureRouter(config, router) {
this.router = router;
config.title = "JSON Routes";
config.map([
{ route: '', name: 'home', moduleId: './home', nav: false },
{ route: 'reporting-index', name: 'reportingIndex', moduleId: './reporting-index', nav: true, title: 'Reporting' }
]);
}
}
<!doctype html>
<html>
<head>
<title>Aurelia Bootstrap Radio Button Group</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://kendo.cdn.telerik.com/2016.2.714/js/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body aurelia-app="main">
<h1>Loading...</h1>
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/jspm_packages/system.js"></script>
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/config.js"></script>
<script>
System.import('aurelia-bootstrapper');
</script>
</body>
</html>
export function configure(aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging();
aurelia.start().then(a => a.setRoot());
}
[
{
"route": "first",
"name": "first",
"moduleId": "first",
"nav": true,
"title": "First Route"
},
{
"route": "second",
"name": "second",
"moduleId": "second",
"nav": true,
"title": "Second Route"
},
{
"route": "third",
"name": "third",
"moduleId": "third",
"nav": true,
"title": "Third Route"
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment