Created
March 24, 2017 14:08
-
-
Save brylie/a1fc5abccda7ea47ef5642c17bcdbd6c to your computer and use it in GitHub Desktop.
Examples of working with events for the book -- Aurelia For Real World Web Applications available here: https://leanpub.com/aurelia-for-real-world-applications/
This file contains hidden or 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>${counter} <button click.delegate="reset()">Reset</button></h1> | |
<h2>Increment</h2> | |
<button click.delegate="increment(1)">+ 1</button> | |
<button click.delegate="increment(5)">+ 5</button> | |
<button click.delegate="increment(100)">+ 100</button> | |
<h2>Decrement</h2> | |
<button click.delegate="decrement(1)">- 1</button> | |
<button click.delegate="decrement(5)">- 5</button> | |
<button click.delegate="decrement(100)">- 100</button> | |
</template> |
This file contains hidden or 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 { | |
counter = 0; | |
reset() { | |
this.counter = 0; | |
} | |
increment(by) { | |
this.counter = this.counter + by; | |
} | |
decrement(by) { | |
this.counter = this.counter - by; | |
} | |
} |
This file contains hidden or 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