Skip to content

Instantly share code, notes, and snippets.

@lstarky
Last active December 30, 2016 13:15
Show Gist options
  • Save lstarky/de0a9a277ddbaf6ff39331f3fc61cfe1 to your computer and use it in GitHub Desktop.
Save lstarky/de0a9a277ddbaf6ff39331f3fc61cfe1 to your computer and use it in GitHub Desktop.
Liam's Radio Boxes
<template>
<h1>Hello, ${fname}!</h1>
<hr>
<label repeat.for="option of options">
<input type="radio" name="opta" model.bind="option" checked.bind="$parent.selectedOption">
${option.value}<br>
</label>
Selected: <strong>${selectedOption.id} (${selectedOption.value})</strong>
</template>
export class App {
constructor() {
this.fname = "Liam";
this.options = [{id: 1, value: "Red"}, {id: 2, value: "Blue", selected: true}, {id: 3, value: "Green"}];
for (let option of this.options) {
if (option.selected) {
this.selectedOption = option;
}
}
}
}
<!doctype html>
<html>
<head>
<title>Aurelia</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body aurelia-app="main">
<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>
export function configure(aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging();
aurelia.start().then(() => aurelia.setRoot());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment