Skip to content

Instantly share code, notes, and snippets.

@Thanood
Last active May 11, 2016 13:40
Show Gist options
  • Save Thanood/11fc0a8f6cef7c5421bbe2e9baf2062b to your computer and use it in GitHub Desktop.
Save Thanood/11fc0a8f6cef7c5421bbe2e9baf2062b to your computer and use it in GitHub Desktop.
Aurelia - dynamic lists
<template>
<div>
<div style="border: solid 1px green;" repeat.for="item of topItems">${item}</div>
<div style="border: solid 1px orange;" repeat.for="item of items">${item}</div>
<div style="border: solid 1px blue;" repeat.for="item of bottomItems">${item}</div>
</div>
</template>
export class App {
topItems = [ 1,2,3,4,5 ];
items = [ 6,7,8,9 ];
bottomItems = [10,11,12,13,14];
constructor() { }
getList(whichList) {
//console.log('getList', this.lists);
if (this.lists && this.lists[whichList]) {
return this.lists[whichList];
}
}
}
<!doctype html>
<html>
<head>
<title>Aurelia</title>
<link rel="stylesheet" href="styles.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body aurelia-app="main">
<h1>Loading...</h1>
<script src="https://cdn.rawgit.com/jdanyow/aurelia-plunker/v0.11.10/jspm_packages/system.js"></script>
<script src="https://cdn.rawgit.com/jdanyow/aurelia-plunker/v0.11.10/config2.js"></script>
<script>
System.import('aurelia-bootstrapper');
</script>
</body>
</html>
/*******************************************************************************
* The following two lines enable async/await without using babel's
* "runtime" transformer. Uncomment the lines if you intend to use async/await.
*
* More info here: https://github.com/jdanyow/aurelia-plunker/issues/2
*/
//import regeneratorRuntime from 'babel-runtime/regenerator';
//window.regeneratorRuntime = regeneratorRuntime;
/******************************************************************************/
export function configure(aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging();
aurelia.start().then(a => a.setRoot());
}
/* Styles go here */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment