Skip to content

Instantly share code, notes, and snippets.

@niieani
Created June 1, 2016 16:47
Show Gist options
  • Save niieani/1a580b9fe19d4ce90ebd478ab41d0692 to your computer and use it in GitHub Desktop.
Save niieani/1a580b9fe19d4ce90ebd478ab41d0692 to your computer and use it in GitHub Desktop.
Aurelia Nested Router Problem
<template>
<router-view></router-view>
</template>
export class App {
configureRouter(config, router) {
config.map([
{ route: '', name: 'one', moduleId: './one', nav: true, title: 'One' }
]);
this.router = router;
}
message = "hello from app";
}
<!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>
<p>Test (first-level router): ${router} / ${message} / ${message2}</p>
<router-view></router-view>
<!-- bindings on router-view also don't work -->
<!--<router-view message.bind="message"></router-view>-->
</template>
export class One {
configureRouter(config, router) {
config.map([
{ route: '', name: 'two', moduleId: './two', nav: true, title: 'Two' }
]);
this.router = router;
}
message2 = "hello from one";
}
<template>
<p>Test (nested router): ${router} / ${message} / ${message2}</p>
</template>
// import {bindable} from 'aurelia-framework';
export class Two {
// doesn't even work when we try to bind these values
// @bindable message;
// @bindable message2;
// @bindable router;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment