Skip to content

Instantly share code, notes, and snippets.

@tkhyn
Created June 14, 2017 10:05
Show Gist options
  • Save tkhyn/ceda36a5c6481c2b629e7b117864c3c7 to your computer and use it in GitHub Desktop.
Save tkhyn/ceda36a5c6481c2b629e7b117864c3c7 to your computer and use it in GitHub Desktop.
Set manipulation and repeat.for
<template>
<h1 repeat.for="m of messages">${m}</h1>
<button click.trigger="change()">Change messages</button>
</template>
export class App {
messages = new Set();
bind() {
this.messages.add('Hello World');
}
change() {
this.messages.delete('Hello World');
this.messages.add('Hi');
this.messages.delete('Hi');
}
}
<!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