Skip to content

Instantly share code, notes, and snippets.

@pKrav75
Forked from jdanyow/app.html
Last active January 27, 2017 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pKrav75/2c563a67fd3b0ee91aee8178d42f48c8 to your computer and use it in GitHub Desktop.
Save pKrav75/2c563a67fd3b0ee91aee8178d42f48c8 to your computer and use it in GitHub Desktop.
Test composition
<template>
<require from="myelem"></require>
<require from="base-element"></require>
<div>Hello</div>
<!-- aValue is a bindable property of the base-element which is included in myElem -->
<myelem aValue="topLevel"></myelem>
<hr>
</template>
export class App {
}
<template>
<div view-spy compile-spy>${avalue}</div>
</template>
import { bindable } from 'aurelia-framework';
export class baseElement{
@bindable avalue = "initial";
created(owningView: View, myView: View){
console.log('0 ' + owningView);
}
bind(bindingContext: Object, overrideContext: Object){
console.log('1 ' + JSON.stringify(bindingContext));
console.log('2 ' + JSON.stringify(overrideContext));
}
}
<!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-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>
export function configure(aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging();
aurelia.start().then(a => a.setRoot());
}
<template>
<require from="base-element"></require>
<base-element></base-element>
<div>${aname}</div>
</template>
import { bindable } from 'aurelia-framework';
export class myelem {
@bindable aname = "aName";
bind(bindingContext: Object, overrideContext: Object){
console.log('3 ' + JSON.stringify(bindingContext));
console.log('4 ' + JSON.stringify(overrideContext));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment