Skip to content

Instantly share code, notes, and snippets.

Created July 4, 2016 11:20
Show Gist options
  • Save anonymous/b97b6ca5a2e30b72d68bd77d0068eb71 to your computer and use it in GitHub Desktop.
Save anonymous/b97b6ca5a2e30b72d68bd77d0068eb71 to your computer and use it in GitHub Desktop.
Aurelia view engine hooks
<template>
<p>How to get selected checkbox values to array?</p>
<p>Follwoging <a href="http://aurelia.io/hub.html#/doc/article/aurelia/framework/latest/cheat-sheet/5" target="_blank">sample</a> isn't workign:</p>
<label repeat.for="color of colors">
<input type="checkbox" value.bind="color" checked.bind="$parent.favoriteColors" />
${color}
</label>
<p>PROBLEM: expecting array of selected values, not boolean: favoriteColors=${favoriteColors}</p>
</template>
export class App {
colors = ["red", "green", "blue"];
}
<!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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment