Last active
May 12, 2016 11:08
-
-
Save lukechilds/50b5af249b57d1f18577bdd6cc4bfe33 to your computer and use it in GitHub Desktop.
Aurelia Image reuse template bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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