Skip to content

Instantly share code, notes, and snippets.

@Baudin999
Forked from niieani/app.html
Last active September 7, 2016 14:52
Show Gist options
  • Save Baudin999/f41512a9918c7cd46cc948c0f5c0bf03 to your computer and use it in GitHub Desktop.
Save Baudin999/f41512a9918c7cd46cc948c0f5c0bf03 to your computer and use it in GitHub Desktop.
Aurelia Compose Containerless Gist
<template>
<ck-container>
<compose repeat.for="item of items"
view="${item.view}.html"
view-model="${item.view}"
model.bind="item.model"
containerless />
</ck-container>
</template>
export class App {
constructor() {
this.items = [
{ view:"test" },
{ view:"test", model: { value: "some value" } }
];
}
}
<template>
<h1>My container element</h1>
<div>
<slot></slot>
</div>
</template>
import {containerless,customElement} from 'aurelia-framework';
@containerless
@customElement('ck-container')
export class Container {
constructor() {
}
}
<!doctype html>
<html>
<head>
<title>Aurelia</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
compose {
outline: 3px solid blue;
}
</style>
</head>
<body aurelia-app>
<h1>Loading...</h1>
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/jspm_packages/system.js"></script>
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/config.js"></script>
<script>
System.import('aurelia-bootstrapper').then(bootstrapper => {
bootstrapper.bootstrap(aurelia => {
aurelia.use
.standardConfiguration()
.globalResources('container');
});
});
</script>
</body>
</html>
<template>
<div>${message}</div>
</template>
export class Test {
constructor(message) {
this.message = "hello world";
}
activate(model) {
if (model) {
this.message = model.value;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment