Skip to content

Instantly share code, notes, and snippets.

@jsobell
Created July 5, 2016 23:38
Show Gist options
  • Select an option

  • Save jsobell/d6d05ac4a29842bc75359f1c719a2318 to your computer and use it in GitHub Desktop.

Select an option

Save jsobell/d6d05ac4a29842bc75359f1c719a2318 to your computer and use it in GitHub Desktop.
Aurelia Router Gist
<template>
<ul>
<li repeat.for='r of router.navigation'><a href='${r.href}'>Go to ${r.title}</a></li>
</ul>
<h1>${message}</h1>
<router-view></router-view>
</template>
export class App {
router;
message = 'Hello World!';
configureRouter(config: RouterConfiguration, router: Router) {
this.router = router;
config.title = 'Test app';
//config.addPipelineStep('authorize', AuthorizeStep); // Add a route filter to the authorize extensibility point.
config.map([
{ route: '/', name: 'root', moduleId: 'home', title:'Home', nav: true },
{ route: 'test1', name: 'test1', moduleId: 'test1', title:'Test#1', nav: true },
{ route: 'test2', name: 'test2', moduleId: 'test2', title:'Test#2', nav: true }
]);
}
}
<template>Home on the range...</template>
export class home {
}
<!doctype html>
<html>
<head>
<title>Aurelia</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body aurelia-app>
<h1>Loading...</h1>
<script src="https://jdanyow.github.io/rjs-bundle/node_modules/requirejs/require.js"></script>
<script src="https://jdanyow.github.io/rjs-bundle/config.js"></script>
<script src="https://jdanyow.github.io/rjs-bundle/bundles/aurelia.js"></script>
<script src="https://jdanyow.github.io/rjs-bundle/bundles/babel.js"></script>
<script>
require(['aurelia-bootstrapper']);
</script>
</body>
</html>
<template>This is in test1!</template>
export class test1 {
}
<template>This is in test2!</template>
export class test2 {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment