Skip to content

Instantly share code, notes, and snippets.

@timfish
Last active August 1, 2018 12:18
Show Gist options
  • Save timfish/47988738fab2a2756e1396774033df2c to your computer and use it in GitHub Desktop.
Save timfish/47988738fab2a2756e1396774033df2c to your computer and use it in GitHub Desktop.
remove svg wrappers
<template>
<require from="./select-component"></require>
<select-component selected.bind="selected"></select-component>
<div>
Selected: ${selected.name}
</div>
</template>
import { viewEngineHooks } from 'aurelia-framework'
export class App {
selected;
}
<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>
<template>
<button repeat.for="each of options"
click.delegate="select(each)"
css="margin:5px; border: 3px solid ${selected === each ?'blue':'transparent'}">
${each.name}
</button>
</template>
import {containerless, bindable, customElement, bindingMode } from 'aurelia-framework'
// @containerless
@customElement('select-component')
export class SelectComponent {
options = [
{name:'One'},
{name:'Two'},
{name:'Three'},
{name:'Four'},
{name:'Five'},
];
@bindable({
defaultBindingMode: bindingMode.twoWay
}) selected;
select(selected){
this.selected = selected;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment