Skip to content

Instantly share code, notes, and snippets.

@lukechilds
Last active May 12, 2016 11:08
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 lukechilds/50b5af249b57d1f18577bdd6cc4bfe33 to your computer and use it in GitHub Desktop.
Save lukechilds/50b5af249b57d1f18577bdd6cc4bfe33 to your computer and use it in GitHub Desktop.
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