Skip to content

Instantly share code, notes, and snippets.

@lukechilds

lukechilds/app.html

Last active May 12, 2016
Embed
What would you like to do?
Aurelia Image reuse template bug
<template>
<h1>${message}</h1>
<button click.delegate="addImage('before')">Add image before</button>
<button click.delegate="addImage('after')">Add image after</button>
<div>
<img width="200" repeat.for="image of images" src.bind="image" />
</div>
</template>
export class App {
constructor(observerLocator, taskQueue) {
this.message = 'Hello World!';
this.images = [];
}
addImage(location) {
const newImage = `https://placehold.it/1000?text=${this.images.length}`;
if(location == 'before') {
this.images.unshift(newImage);
} else {
this.images.push(newImage);
}
}
}
<!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
You can’t perform that action at this time.