Skip to content

Instantly share code, notes, and snippets.

@JontyMC
Forked from evenflow58/app.html
Last active February 6, 2018 08:38
Show Gist options
  • Save JontyMC/cbe9c187550bbceb8a8b3353f0e943c8 to your computer and use it in GitHub Desktop.
Save JontyMC/cbe9c187550bbceb8a8b3353f0e943c8 to your computer and use it in GitHub Desktop.
Replaceable template nesting
<template>
<require from="./component-one.html"></require>
<require from="./component-two.html"></require>
<component-one></component-one>
<component-two>
<template replace-part="item-template">This should override default template 2, but doesn't</template>
</component-two>
</template>
export class App { }
<template>
<div>
<template replaceable part="item">Default template 1</template>
</div>
</template>
<template>
<require from="./component-one.html"></require>
<component-one>
<template replace-part="item">This overrides default template 1</template>
</component-one>
<component-one>
<template replace-part="item">
<template replaceable part="item-template">Default template 2</template>
</template>
</component-one>
</template>
<html>
<head>
<title>Aurelia</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
<style>
.form-component {
display: block;
}
</style>
</head>
<body aurelia-app>
<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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment