Skip to content

Instantly share code, notes, and snippets.

@RWOverdijk
Forked from jdanyow/app.html
Last active April 18, 2017 10:07
Show Gist options
  • Save RWOverdijk/b1b6ddd77870baed5432f4132c2949eb to your computer and use it in GitHub Desktop.
Save RWOverdijk/b1b6ddd77870baed5432f4132c2949eb to your computer and use it in GitHub Desktop.
Aurelia Gist
<template>
<h1>${message}</h1>
<select
value.bind="value"
class="form-control ${classes}"
name.bind="name"
autofocus.bind="autofocus"
required.bind="required"
>
<option repeat.for="option of optionLabels" model.bind="option" t="${option.label || option}">${option.label || option}</option>
</select>
</template>
export class App {
message = 'Hello World!';
selectOptions = [
{ value: '0800', name: '08:00', label: '08:00' }
];
get optionLabels() {
return this.selectOptions.map(option => {
if (typeof option === 'object' && this.optionLabel) {
option.label = option[this.optionLabel] || '';
}
return option;
});
}
}
<!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://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/jspm_packages/system.js"></script>
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/config.js"></script>
<script>
System.import('aurelia-bootstrapper');
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment