Skip to content

Instantly share code, notes, and snippets.

@dstroyrofworlds
Forked from jdanyow/app.html
Last active April 30, 2016 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dstroyrofworlds/53ce02fb5b71c349efdb4935d5583489 to your computer and use it in GitHub Desktop.
Save dstroyrofworlds/53ce02fb5b71c349efdb4935d5583489 to your computer and use it in GitHub Desktop.
Aurelia RequireJS Gist
<template>
<require from="./xbutton.html"></require>
<require from="./listen"></require>
<h1>${message}</h1>
<xbutton click.bind="click"></xbutton>
<listen xxx.two-way="xxx"></listen>
</template>
import {bindable} from 'aurelia-framework';
export class App {
message = 'Hello World!';
@bindable() xxx = false;
click() {
console.log('app before' + this.xxx);
this.xxx = true;
console.log('app after' + this.xxx);
}
xxxChanged(newValue) {
console.log('app - xxx changed to ' + newValue + ' xxx ' + this.xxx);
}
}
<!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>
<template>
Show <input type="checkbox" checked.bind="xxx">
</template>
import {bindable} from 'aurelia-framework';
export class ListenCustomElement {
@bindable() xxx;
constructor() {
console.log('listen init');
}
xxxChanged(newValue) {
console.log('listen - xxx changed to ' + newValue);
}
}
<template bindable="click">
<button click.trigger="click()">Click Me</button>
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment