Skip to content

Instantly share code, notes, and snippets.

@fabioluz
Last active June 12, 2017 17:02
Show Gist options
  • Save fabioluz/59d3fdb5f5b3862795c490aba1731b92 to your computer and use it in GitHub Desktop.
Save fabioluz/59d3fdb5f5b3862795c490aba1731b92 to your computer and use it in GitHub Desktop.
Aurelia RJS Router
<template>
<router-view></router-view>
</template>
export class App {
message = 'Hello World!';
configureRouter(config, router) {
let step = new AuthorizeStep;
config.addAuthorizeStep(step)
config.map([
{ route: '', name: 'home', moduleId: 'route-1', settings: { foo: '1' } }
]);
}
}
class AuthorizeStep {
run(navigationInstruction, next) {
let instructions = navigationInstruction.getAllInstructions();
console.log(instructions);
return next();
}
}
<!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>
<router-view></router-view>
</template>
export class Route1 {
configureRouter(config, router) {
config.map([{ route: '', name: 'home', moduleId: 'subroute-1', settings: { foo: '2' } }]);
}
}
<template>
2
</template>
export class Subroute1 {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment