Skip to content

Instantly share code, notes, and snippets.

@lebolo
Forked from jmezach/app.html
Last active February 21, 2017 15:25
Show Gist options
  • Save lebolo/176ed0b4f0e5da77d7847fa1af878e35 to your computer and use it in GitHub Desktop.
Save lebolo/176ed0b4f0e5da77d7847fa1af878e35 to your computer and use it in GitHub Desktop.
Aurelia Gist
<template>
<require from="./dropdown"></require>
<h1>${message}</h1>
<dropdown>
<p class="dropdown-item" repeat.for="item of items">${item}</p>
</dropdown>
<a click.delegate="changeItems()" href="#">Change items</a>
<a click.delegate="mutateItems()" href="#">Mutate items</a>
</template>
export class App {
message = 'Hello World!';
items = ['Item 1', 'Item 2'];
changeItems() {
this.items = ['Item 3', 'Item 4'];
}
mutateItems() {
this.items.push('Item 4');
}
}
<template>
<h1>${set}</h1>
<slot></slot>
</template>
import { children } from 'aurelia-framework';
export class Dropdown {
@children('.dropdown-item') dropdownItems = ['Item 0'];
set = 'First set';
dropdownItemsChanged(newValue, oldValue) {
console.log('dropdown changed', newValue, oldValue);
this.set = 'Second set';
}
}
<!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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment