Skip to content

Instantly share code, notes, and snippets.

@jsobell
Created April 29, 2016 05:47
Show Gist options
  • Select an option

  • Save jsobell/834cbcced9b5eeacef66ae4193df7393 to your computer and use it in GitHub Desktop.

Select an option

Save jsobell/834cbcced9b5eeacef66ae4193df7393 to your computer and use it in GitHub Desktop.
Aurelia simple repeat
<template>
Current user: ${chosenuser.lastName}
<select class="form-control control-label" value.bind="chosenuser" >
<option repeat.for="user of users" model.bind="user">
${user.firstName} </option>
</select>
</template>
export class App {
users = [
{ id: 1, firstName: 'Rob', lastName: 'Eisenberg' },
{ id: 2, firstName: 'Jeremy', lastName: 'Danyow' },
{ id: 3, firstName: 'Matt', lastName: 'Broadst' }];
chosenuser=this.users[2];
}
<!doctype html>
<html>
<head>
<title>Aurelia</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
</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>
a {
display: block;
}
a:link {
color: black;
text-decoration: none;
}
.collection-item
{
background: lightgray;
}
/* since you set background property on .collection-item, this style must come after .collection-item otherwise it's not applied */
.active {
background: blue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment