Skip to content

Instantly share code, notes, and snippets.

@valichek
Last active June 16, 2016 09:03
Show Gist options
  • Save valichek/ed38d664a94f3192698c8bbb959004ae to your computer and use it in GitHub Desktop.
Save valichek/ed38d664a94f3192698c8bbb959004ae to your computer and use it in GitHub Desktop.
Slots and binding context issue
<template>
<require from="./custom"></require>
<custom>
<button click.delegate="doSmth()">First slot</button>
</custom>
<custom>
<!--comment here-->
</custom>
</template>
export class App {
}
<template>
<slot>
<button click.delegate="doSmth()">Default</button>
</slot>
</template>
export class Custom {
doSmth() {
alert("doSmth");
}
}
<!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">
<style>
registration-form {
display: block;
max-width: 300px;
margin-left: auto;
margin-right: auto;
}
</style>
</head>
<body aurelia-app="main">
<h1>Loading...</h1>
<script src="https://jdanyow.github.io/rjs-bundle/node_modules/requirejs/require.js"></script>
<script src="https://jdanyow.github.io/rjs-bundle/config.js"></script>
<script src="https://jdanyow.github.io/rjs-bundle/bundles/aurelia.js"></script>
<script src="https://jdanyow.github.io/rjs-bundle/bundles/babel.js"></script>
<script>
require(['aurelia-bootstrapper']);
</script>
</body>
</html>
export function configure(aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging();
aurelia.start().then(() => aurelia.setRoot());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment