Skip to content

Instantly share code, notes, and snippets.

@vuorinem
Created May 4, 2016 16:51
Show Gist options
  • Save vuorinem/484c034828ee4c3328e97afdc9a443d7 to your computer and use it in GitHub Desktop.
Save vuorinem/484c034828ee4c3328e97afdc9a443d7 to your computer and use it in GitHub Desktop.
Aurelia - Sortable
<template>
<require from="./node"></require>
<!-- Works if using view-only (from="./node.html") -->
<node nodes.bind="nodes"></node>
</template>
export class App {
nodes = [
{
name: 'A', children: [
{
name: 'A.1', children: [
{ name: 'A.1.A', children: [] },
]
}
]
}
];
}
<!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://ashleygrant.github.io/rjs-bundle/node_modules/requirejs/require.js"></script>
<script src="https://ashleygrant.github.io/rjs-bundle/config.js"></script>
<script>
require.config({
paths: {
"sortable": "https://cdnjs.cloudflare.com/ajax/libs/Sortable/1.4.2/Sortable.min"
}
});
</script>
<script src="https://ashleygrant.github.io/rjs-bundle/bundles/aurelia.js"></script>
<script src="https://ashleygrant.github.io/rjs-bundle/bundles/babel.js"></script>
<script>
require(['aurelia-bootstrapper']);
</script>
</body>
</html>
<template bindable="nodes">
<ul if.bind="nodes.length > 0">
<li repeat.for="node of nodes">
${node.name}
<node nodes.bind="node.children"></node>
</li>
</ul>
</template>
import {bindable} from 'aurelia-framework';
export class Node {
@bindable nodes = null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment