Skip to content

Instantly share code, notes, and snippets.

@allencoded
Forked from jdanyow/app.html
Last active October 31, 2016 18:42
Show Gist options
  • Save allencoded/3a928a75989d489e04f99a6d6fbdb0fe to your computer and use it in GitHub Desktop.
Save allencoded/3a928a75989d489e04f99a6d6fbdb0fe to your computer and use it in GitHub Desktop.
Aurelia Gist
<template>
<require from="./test"></require>
<h1>${message}</h1>
<test stuff.bind="stuff"></test>
</template>
export class App {
message = 'Hello World!';
constructor() {
this.stuff = [1, 2, 3, 4, 5];
}
}
<!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>
<template>
<div repeat.for="s of stuff" if.bind="stuff.length > 0">
<div if.bind="s > 0">
<button click.trigger="remove($index)">${s}</button>
</div>
</div>
</template>
import { bindable, bindingMode } from 'aurelia-framework';
export class Test {
@bindable({ defaultBindingMode: bindingMode.twoWay }) stuff;
remove(i) {
this.stuff.splice(i, 1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment