Last active
November 20, 2017 11:24
-
-
Save thinkOfaNumber/87aaf4c98b7276d88a8db84fcccecbc9 to your computer and use it in GitHub Desktop.
Aurelia router-view
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
. |
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> | |
First click one of these: | |
<ul> | |
<li repeat.for="i of 3" click.delegate="select(i)" class="${selected===i ? 'active' : ''}">Menu item ${i+1}</li> | |
</ul> | |
Now click a link:<br/> | |
<a route-href="route: page">Go to page</a><br/> | |
<a route-href="route: home">Go to home</a><br/> | |
Layout Contents: | |
<div class="layout"> | |
<router-view></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 { | |
selected = null; | |
select(i) { | |
console.log("selecting " + i); | |
this.selected = i; | |
} | |
configureRouter(config, router){ | |
config.map([ | |
{ route: '', name: 'home', moduleId: 'home' }, | |
{ route: 'page', name: 'page', moduleId: 'page' } | |
]); | |
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
<template> | |
Home | |
</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 Home { | |
} |
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"> | |
<link href="style.css" rel="stylesheet"> | |
</head> | |
<body aurelia-app> | |
<h1>Loading...</h1> | |
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/jspm_packages/system.js"></script> | |
<script src="https://rawgit.com/jedd-ahyoung/aurelia-bundle/master/config.js"></script> | |
<script> | |
System.import('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> | |
Page | |
</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 Page { | |
} |
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
.layout { | |
display: block; | |
border: 2px groove; | |
} | |
.legend { | |
display: block; | |
padding-left: 2px; | |
padding-right: 2px; | |
border: none; | |
} | |
.active { | |
text-decoration: underline; | |
text-transform: uppercase; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment