Skip to content

Instantly share code, notes, and snippets.

@AshleyGrant
Created May 21, 2017 17:07
Show Gist options
  • Save AshleyGrant/89d8fea52401625c0e26cae977060967 to your computer and use it in GitHub Desktop.
Save AshleyGrant/89d8fea52401625c0e26cae977060967 to your computer and use it in GitHub Desktop.
D3 + Aurelia
<template>
<require from="./pager"></require>
<div pager="numberOfPages.bind: numberOfPages">Number of pages: ${numberOfPages}</div>
</template>
export class App {
numberOfPages = 0;
}
<!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>
import {bindable, bindingMode, computedFrom} from 'aurelia-framework';
export class PagerCustomAttribute {
totalPages = 0;
constructor() {
setInterval(() => {
console.log('setting totalpages');
this.totalPages++
}, 1000);
}
get numberOfPages() {
return this.totalPages
}
@bindable({defaultBindingMode: bindingMode.twoWay})
set numberOfPages(value) {
console.log('setting numberofPages')
this.totalPages = value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment