Skip to content

Instantly share code, notes, and snippets.

@jdanyow
Forked from AshleyGrant/app.html
Last active May 13, 2016 01:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdanyow/e931202307361d472c3e0ee4f523a833 to your computer and use it in GitHub Desktop.
Save jdanyow/e931202307361d472c3e0ee4f523a833 to your computer and use it in GitHub Desktop.
<template>
<ul>
<li repeat.for="person of people">
${person.firstName} ${person.lastName}
<button click.delegate="editPerson = person">Edit</button>
</li>
</ul>
<form if.bind="editPerson" submit.delegate="save()">
<label>
First Name:
<input ref="firstNameInput" value.one-way="editPerson.firstName">
</label>
<label>
Last Name:
<input ref="lastNameInput" value.one-way="editPerson.lastName">
</label>
<button type="submit">Save</button>
<button type="button" click.delegate="editPerson = null">Cancel</button>
</form>
</template>
export class App {
people = [
{ firstName: 'John', lastName: 'Doe' },
{ firstName: 'Jane', lastName: 'Smith' },
{ firstName: 'Bob', lastName: 'Smith' }
];
editPerson = null;
save() {
this.editPerson.firstName = this.firstNameInput.value;
this.editPerson.lastName = this.lastNameInput.value;
this.editPerson = null;
}
}
<!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://ashleygrant.github.io/rjs-bundle/node_modules/requirejs/require.js"></script>
<script src="https://ashleygrant.github.io/rjs-bundle/config.js"></script>
<script>
require.config({
paths: {
"sortable": "https://cdnjs.cloudflare.com/ajax/libs/Sortable/1.4.2/Sortable.min"
}
});
</script>
<script src="https://ashleygrant.github.io/rjs-bundle/bundles/aurelia.js"></script>
<script src="https://ashleygrant.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