Last active
May 30, 2020 10:11
-
-
Save d13/946bc745d16ee7888e7bd069aed344e0 to your computer and use it in GitHub Desktop.
Aurelia Gist - nav in a LayoutView
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<require from="nav-bar.html"></require> | |
<!-- this nav works --> | |
<nav-bar router.bind="router"></nav-bar> | |
<div class="page-host" style="margin-top:50px"> | |
<router-view router.bind="router"></router-view> | |
</div> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class App { | |
configureRouter(config, router) { | |
config.title = 'Aurelia'; | |
config.map([ | |
{ | |
layoutView: 'layout-foo.html', | |
route: ['', 'welcome'], | |
name: 'welcome', | |
moduleId: 'module-home', | |
nav: true, | |
title: 'Welcome' | |
}//, | |
//{ layoutView: 'alt-layout.html', route: 'welcome2', name: 'welcome2', moduleId: 'welcome', nav: true, title: 'Welcome Alt Layout' }, | |
]); | |
this.router = router; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template bindable="router"> | |
<require from="nav-bar.html"></require> | |
<div>bar</div> | |
<!-- this nav does not work --> | |
<nav-bar router.bind="router"></nav-bar> | |
<div style="background-color:red;"> | |
<slot name="main-content"></slot> | |
</div> | |
<div style="background-color:blue;"> | |
<slot name="alt-content"></slot> | |
</div> | |
<div>baz</div> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div slot="main-content"> | |
hello world | |
</div> | |
<div slot="alt-content"> | |
hello world 2 | |
</div> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class ModuleHome { | |
message = 'Hello World'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment