Skip to content

Instantly share code, notes, and snippets.

@Vheissu
Last active July 12, 2017 03:23
Show Gist options
  • Save Vheissu/95476d8efa129392ec15aa50bc0c073f to your computer and use it in GitHub Desktop.
Save Vheissu/95476d8efa129392ec15aa50bc0c073f to your computer and use it in GitHub Desktop.
Layout and Layout ViewModel example
<template>
<router-view></router-view>
</template>
export class App {
configureRouter(config, router) {
config.map([
{ route: '', layoutViewModel: 'main', moduleId: 'hello' },
]);
}
}
<template>
<h1>This is hello.html</h1>
<p>I am injected into the layout view (main.html) in the slot element</p>
</template>
export class 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>
<h1>${heading}!</h1>
<slot></slot>
</template
export class MainLayout {
heading = 'Hallo Welt';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment