Skip to content

Instantly share code, notes, and snippets.

@lebolo
Forked from jdanyow/app.html
Last active March 27, 2017 18:15
Show Gist options
  • Save lebolo/db499218b51e769d6208993f70ea535b to your computer and use it in GitHub Desktop.
Save lebolo/db499218b51e769d6208993f70ea535b to your computer and use it in GitHub Desktop.
Aurelia Gist
<template>
<input value.bind="foo"></input>
<h1>${qux}</h1>
</template>
import {inject} from 'aurelia-framework';
import {BindingEngine} from 'aurelia-binding';
@inject(BindingEngine)
export class App {
foo = 'foo';
bar = 'bar';
constructor(bindingEngine) {
this.bindingEngine = bindingEngine;
}
bind() {
let subscription = this.bindingEngine
.propertyObserver(this, 'qux')
.subscribe((newValue, oldValue) => console.log('changed', newValue, oldValue));
}
get qux() {
return this.foo + this.bar;
}
}
<!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