Skip to content

Instantly share code, notes, and snippets.

@lebolo
Last active December 24, 2016 03:12
Show Gist options
  • Save lebolo/b777696e1fb8bf52cbb62d8c00486045 to your computer and use it in GitHub Desktop.
Save lebolo/b777696e1fb8bf52cbb62d8c00486045 to your computer and use it in GitHub Desktop.
Aurelia Gist
<template>
<h1>${message}</h1>
<div class="page-host">
app
<router-view name="left"></router-view>
</div>
<div class="page-host">
app
<router-view name="right"></router-view>
</div>
<div class="page-host">
app
<router-view></router-view>
</div>
</template>
export class App {
message = 'Hello World!';
configureRouter(config, router) {
this.router = router;
config.title = 'Aurelia';
config.map([
{
route: ['', 'app'],
name: 'app',
title: 'app',
viewPorts: {
default: { moduleId: "home" },
left: { moduleId: "left" },
right: { moduleId: "right" }
},
nav: true
}
]);
}
}
<template>
<h1>${message}</h1>
<span>These routes don't work because home.js does not configure any routes</span>
<div class="page-host">
home
<router-view name="left"></router-view>
</div>
<div class="page-host">
home
<router-view name="right"></router-view>
</div>
<div class="page-host">
home
<router-view></router-view>
</div>
<span>These routes don't work because home.js does not configure any routes</span>
</template>
export class Home {
constructor() {
this.message = "hello";
}
}
<!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>
<h2>${message}</h2>
</template>
export class Left {
message = 'Left';
}
<template>
<h2>${message}</h2>
</template>
export class Right {
message = 'Right';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment