Last active
May 1, 2016 01:42
-
-
Save tkhyn/2fba7f5617dd490eef561a2c07c4f6b0 to your computer and use it in GitHub Desktop.
This file contains 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> | |
<router-view></router-view> | |
</template> |
This file contains 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 = 'app' | |
config.options.pushState = true; | |
config.options.hashChange = false; | |
config.map([ | |
{ route: '', moduleId: 'page' }, | |
]); | |
config.mapUnknownRoutes('page'); | |
this.router = router; | |
} | |
} |
This file contains 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="main"> | |
<h1>Loading...</h1> | |
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/jspm_packages/system.js"></script> | |
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/config.js"></script> | |
<script> | |
System.import('aurelia-bootstrapper'); | |
</script> | |
</body> | |
</html> |
This file contains 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 function configure(aurelia) { | |
aurelia.use | |
.defaultBindingLanguage() | |
.defaultResources() | |
.history() | |
.router() | |
.developmentLogging(); | |
aurelia.start().then(a => a.setRoot('app')); | |
} |
This file contains 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> | |
<a href.bind='url' | |
dblclick.trigger="dblclick()">Double-click me</a> | |
<ul> | |
<li repeat.for="m of messages">${m}</li> | |
</ul> | |
</template> |
This file contains 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
const CHARS = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
const N = CHARS.length; | |
export class Page { | |
messages = []; | |
activate(params, config, navigationInstruction) { | |
this.messages.push(`Activating "${navigationInstruction.fragment}"`); | |
} | |
get url() { | |
// generates a random absolute URL | |
// there is no # as we're using hashChange = false | |
var result = '/'; | |
for (var i = 8; i > 0; --i) { | |
result += CHARS[Math.floor(Math.random() * N)] | |
}; | |
return result; | |
} | |
dblclick() { | |
this.messages.push('You double-clicked'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment