Skip to content

Instantly share code, notes, and snippets.

@mbroadst
Last active March 10, 2016 13:35
Show Gist options
  • Save mbroadst/b74bbe825d8e38927947 to your computer and use it in GitHub Desktop.
Save mbroadst/b74bbe825d8e38927947 to your computer and use it in GitHub Desktop.
Aurelia simple grid example
<template>
<require from="my-element"></require>
<my-element></my-element>
</template>
export class App {
}
<!doctype html>
<html>
<head>
<title>Aurelia</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
</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');
</script>
</body>
</html>
<template>
<content></content>
</template>
import {inject, noView, ViewSlot, ViewCompiler} from 'aurelia-framework';
@noView
@inject(ViewSlot, ViewCompiler)
export class MyElement {
constructor(viewSlot, viewCompiler) {
this.viewSlot = viewSlot;
this.viewCompiler = viewCompiler;
}
bind(bindingContext, overrideContext) {
this.render();
}
render() {
let template =
`<template><compose view="some-view.html"></compose></template>`;
let viewFactory = this.viewCompiler.compile(template);
let view = viewFactory.create();
this.viewSlot.add(view);
}
}
<template>
<b>Hello!</b>
</template>
<template>
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment