Created
November 23, 2016 05:50
-
-
Save zakjan/4b48d91c317374528aa9303ff3547f8a to your computer and use it in GitHub Desktop.
Aurelia Gist
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="./item"></require> | |
<h1>${message}</h1> | |
<ul> | |
<li repeat.for="item of items"> | |
${item}: | |
<item item.bind="item" click-handler.bind="itemClicked" title="itemClicked"></item> | |
<item item.bind="item" click-handler.bind="itemClicked.bind($this)" title="itemClicked.bind($this)"></item> | |
<item item.bind="item" click-handler.bind="itemClickedBound" title="itemClickedBound"></item> | |
</li> | |
</ul> | |
</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 { | |
message = 'Hello World!'; | |
items = [1,2,3,4,5]; | |
itemClickedBound = this.itemClicked.bind(this); | |
itemClicked(item) { | |
this.doSomething(item); | |
} | |
doSomething(item) { | |
console.log(item); | |
} | |
} |
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://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/jspm_packages/system.js"></script> | |
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/config.js"></script> | |
<script> | |
System.import('aurelia-bootstrapper'); | |
</script> | |
</body> | |
</html> |
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> | |
<button click.trigger="clickHandler(item)">${title}</button> | |
</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 ItemCustomElement { | |
@bindable item; | |
@bindable clickHandler; | |
@bindable title; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment