Skip to content

Instantly share code, notes, and snippets.

@opcodewriter
Last active March 9, 2016 11:47
Show Gist options
  • Save opcodewriter/59e72b964a1be843fd89 to your computer and use it in GitHub Desktop.
Save opcodewriter/59e72b964a1be843fd89 to your computer and use it in GitHub Desktop.
Aurelia List
<template>
<require from="./list-view"></require>
<list-view items.bind='users'></list-view>
</template>
export class App {
users = [
{ id: 1, firstName: 'Rob', lastName: 'Eisenberg' },
{ id: 2, firstName: 'Jeremy', lastName: 'Danyow' },
{ id: 3, firstName: 'Matt', lastName: 'Broadst' }];
}
<!doctype html>
<html>
<head>
<title>Aurelia</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
</head>
<body aurelia-app>
<h1>Loading...</h1>
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/master/jspm_packages/system.js"></script>
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/master/config.js"></script>
<script>
System.import('aurelia-bootstrapper');
</script>
</body>
</html>
<template>
<div style="background: lightblue">
content:
<content></content>
</div>
</template>
<template>
<ul>
<li repeat.for="item of items"><compose view='${itemTemplate}' containerless><!--what to put here !? --></compose></li>
</ul>
</template>
import {bindable} from 'aurelia-framework'
export class ListView {
@bindable items;
@bindable itemTemplate;
constructor()
{
// default template
this.itemTemplate = './list-view-item-template.html';
}
}
list-view ul
{
padding: 0;
margin: 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment