Skip to content

Instantly share code, notes, and snippets.

@geleto
Last active May 1, 2017 09:01
Show Gist options
  • Save geleto/d1f1b0e13fa1fc12cc73d088ce900a71 to your computer and use it in GitHub Desktop.
Save geleto/d1f1b0e13fa1fc12cc73d088ce900a71 to your computer and use it in GitHub Desktop.
Select array of classes
<template>
<input-select value.two-way="propertyType" choices.bind="propertyTypes" label="Type"></input-select>
<select value.two-way="propertyType">
<option repeat.for="property of propertyTypes" model.bind="propertyType">${property}</option>)
</select>
</template>
class PropertyType{
constructor( name, alias, defaultValue ){
this.name = name;
}
toString(){
return this.name;
}
}
export class App {
propertyTypes = [
new PropertyType("Number","numeric","0"),
new PropertyType("Length", "length", "0"),//todo - units
new PropertyType("Percent", "percent", "100"),
new PropertyType("Color","color","#000000"),
new PropertyType("Checkbox","checkbox","false"),
new PropertyType("Text","text",""),
new PropertyType("Select List","select","0"),
new PropertyType("Choice","buttonradio","0"),
];
propertyType = this.propertyTypes[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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment