Skip to content

Instantly share code, notes, and snippets.

@jdanyow
Created January 11, 2017 13:47
Show Gist options
  • Save jdanyow/84eb0949ff63c3f10a1eff3c337f2c97 to your computer and use it in GitHub Desktop.
Save jdanyow/84eb0949ff63c3f10a1eff3c337f2c97 to your computer and use it in GitHub Desktop.
<template>
<label repeat.for="option of options">
<input type="radio" name="periodOptions" model.bind="option" checked.bind="$parent.selectedOption" click.delegate="clicked()"/>
${option.text}
</label>
<p><pre><code>${selectedOption | stringify}</code></pre></p>
</template>
export class PeriodPanel {
heading = 'Tidsperiode';
options = [];
selectedOption = {};
constructor() {
this.options = [
{id:1, text:'Vis med dagoppløsning'},
{id:2, text:'Vis med timeoppløsning'},
{id:3, text:'Vis periode'}
];
this.selectedOption = this.options[0];
}
clicked() {
console.log(this.selectedOption.id);
return true;
}
}
export class StringifyValueConverter {
toView(value) {
return JSON.stringify(value, null, 2);
}
}
<!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>
/*******************************************************************************
* The following two lines enable async/await without using babel's
* "runtime" transformer.
*
* More info here: https://github.com/jdanyow/aurelia-plunker/issues/2
*
* Feel free to remove these lines if your plunker doesn't use async/await.
*/
import regeneratorRuntime from 'babel-runtime/regenerator';
window.regeneratorRuntime = regeneratorRuntime;
/******************************************************************************/
export function configure(aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging();
aurelia.start().then(a => a.setRoot());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment