-
-
Save jdanyow/052bbfdb6bdc260d030d44ee07aa4f72 to your computer and use it in GitHub Desktop.
aurelia-test
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> | |
<require from="./child"></require> | |
<button click.delegate="newItems()">new items</button> | |
<child repeat.for="item of items" id.bind="item.id" value.bind="item.value"></child> | |
</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 { | |
items = [] | |
newItems() { | |
if (this.items.length === 0) { | |
this.items.push({id: 'A', value: 1}); | |
} else { | |
const oldItem = this.items[0]; | |
this.items = [{id: 'new', value: 'new'}]; | |
oldItem.value = 2; | |
} | |
} | |
} |
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> | |
<div style="border: 1px solid gray"> | |
<p>id:${id}, value: ${value}</p> | |
</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
import {bindable} from 'aurelia-framework'; | |
export class Child { | |
@bindable id = ''; | |
@bindable value = 0; | |
bind() { | |
$('body').append(`<p>id:${this.id} bind</p>`); | |
} | |
valueChanged(newValue, oldValue) { | |
$('body').append(`<p>id:${this.id} value changed to ${newValue}</p>`); | |
} | |
unbind() { | |
$('body').append(`<p>id:${this.id} unbind</p>`); | |
} | |
} |
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://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script> | |
<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