Skip to content

Instantly share code, notes, and snippets.

@3cp
Last active October 11, 2016 03:07
Show Gist options
  • Save 3cp/54c4c0ce81f49de3327549677adb21dd to your computer and use it in GitHub Desktop.
Save 3cp/54c4c0ce81f49de3327549677adb21dd to your computer and use it in GitHub Desktop.
valueChanged
<template>
<require from="./line"></require>
<line value.bind="1"></line>
</template>
export class App {
}
<!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>
<template>
${value}
</template>
import {bindable} from 'aurelia-framework';
export class Line {
@bindable value;
// uncomment bind callback will make initial valueChanged unfired
// bind() {}
valueChanged(newV, oldV) {
console.log('value changed from ' + oldV + ' to ' + newV);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment