Skip to content

Instantly share code, notes, and snippets.

@mbroadst
Created April 25, 2016 15:09
Show Gist options
  • Save mbroadst/7dc013db173bafff95620eda6190a487 to your computer and use it in GitHub Desktop.
Save mbroadst/7dc013db173bafff95620eda6190a487 to your computer and use it in GitHub Desktop.
Aurelia RequireJS Gist
<template>
<require from="./grid"></require>
<require from="./column"></require>
<grid>
<column header="blah"></column>
<column header="test"></column>
<column header="thing"></column>
<column header="balloons"></column>
</grid>
</template>
export class App {
}
import {
inject,
bindable,
noView,
processContent
} from 'aurelia-framework';
@noView
@processContent(false)
@inject(Element)
export class Column {
@bindable header
}
<template>
<content></content>
<table ref="table" border=1>
<thead>
<tr>
<th repeat.for="column of columns">
${column.header}
</th>
</tr>
</thead>
<tbody ref="tbody"></tbody>
<tfoot>
<tr>
<th colspan.bind="columns.length">
<select>
<option value="10">10</option>
<option value="50">50</option>
<option value="100">100</option>
</select>
</th>
</tr>
</tfoot>
</table>
columns.length: ${columns.length}
</template>
import {children} from 'aurelia-framework';
export class Grid {
@children('column') columns
}
<!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