Skip to content

Instantly share code, notes, and snippets.

@TylerJPresley
Last active April 24, 2016 04:54
Show Gist options
  • Save TylerJPresley/08468ea58bdcbdb73cb8f9063980f3c0 to your computer and use it in GitHub Desktop.
Save TylerJPresley/08468ea58bdcbdb73cb8f9063980f3c0 to your computer and use it in GitHub Desktop.
Aurelia simple repeat
<template>
<require from="bootstrap/css/bootstrap.css"></require>
<require from='./items-list'></require>
<items-list close.call="close($event)"></items-list>
</template>
export class App {
constructor() {
}
close() {
alert("alert in app.js");
}
}
<!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/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>
<button click.trigger="close()" class="btn btn-danger">Close</button>
</template>
import {customElement, bindingMode, bindable, inject} from 'aurelia-framework';
@bindable({ name: 'close', defaultBindingMode: bindingMode.oneWay })
@customElement('items-list')
@inject(Element)
export class ItemsList {
constructor(element) {
this.element = element;
}
}
a {
display: block;
}
a:link {
color: black;
text-decoration: none;
}
.collection-item
{
background: lightgray;
}
/* since you set background property on .collection-item, this style must come after .collection-item otherwise it's not applied */
.active {
background: blue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment