Skip to content

Instantly share code, notes, and snippets.



Last active May 12, 2016
What would you like to do?
Aurelia Inconsistent Template Behaviour Fix
<button click.delegate="addNumber('before')">Add number before</button>
<button click.delegate="addNumber('after')">Add number after</button>
<span repeat.for="number of numbers">${number}</span>
import {inject, ObserverLocator, TaskQueue} from 'aurelia-framework';
@inject(ObserverLocator, TaskQueue)
export class App {
constructor(observerLocator, taskQueue) {
this.message = 'Hello World!';
this.numbers = [];
observerLocator.getArrayObserver(this.numbers).subscribe(() => {
taskQueue.queueTask(() => {
alert(`If you add number after everything should be good now.\n\nIf you add number before elements will be duplicated, after exiting this alert rendering will complete`);
addNumber(location) {
const newNumber = this.numbers.length;
if(location == 'before') {
} else {
<!doctype html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<body aurelia-app>
<script src=""></script>
<script src=""></script>
<script src=""></script>
<script src=""></script>
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.