Skip to content

Instantly share code, notes, and snippets.

@charlespockert
Created May 15, 2016 19:17
Show Gist options
  • Save charlespockert/9cec9a4ac208618dfa05301de55764f3 to your computer and use it in GitHub Desktop.
Save charlespockert/9cec9a4ac208618dfa05301de55764f3 to your computer and use it in GitHub Desktop.
<template>
<require from="button1"></require>
<require from="panel"></require>
<div class="page-host">
<panel buttons.bind="[{ name: 'button1' }, {name: 'button2'}, {name: 'button3' }]">
<template replace-part="button-template">
<button>${button.name}</button>
</template>
</panel>
</div>
</template>
export class App {
}
<template>
<button type="button" class="btn btn-default" click.delegate="onclick()">
<content></content>
</button>
</template>
export class Button1 {
name;
constructor() {
}
onclick() {
console.log("button clicked");
}
}
<!doctype html>
<html>
<head>
<title>Aurelia</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"></link>
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.6/system.js"></script>
<script src="https://cdn.rawgit.com/valichek/aurelia-bundle/i18n-0.5.2v0.0.4/config.js"></script>
</head>
<body aurelia-app="main">
<h1>Loading...</h1>
<script>
System.import('aurelia-bootstrapper');
</script>
</body>
</html>
export function configure(aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging();
aurelia.start().then(() => aurelia.setRoot());
}
<template>
This is the panel ${buttons.length}
<ul>
<li repeat.for="button of buttons">
<template replaceable part="button-template">Test</template>
</li>
</ul>
</template>
import {bindable} from 'aurelia-framework';
export class Panel {
@bindable buttons = [];
constructor() {
}
}
/* todo: add styles */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment