Skip to content

Instantly share code, notes, and snippets.

@djedi
Created October 27, 2017 22:11
Show Gist options
  • Save djedi/d19fbc13bbac4ed7b2ba3b5bf7dd4cec to your computer and use it in GitHub Desktop.
Save djedi/d19fbc13bbac4ed7b2ba3b5bf7dd4cec to your computer and use it in GitHub Desktop.
Aurelia Replaceable Parts
<template>
<require from="./comp.html"></require>
<comp></comp>
<comp>
<template replace-part="repl">
I've been replaced.
</template>
</comp>
<comp>
<template replace-part="repl">
<iframe width="560" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" allowfullscreen></iframe>
</template>
</comp>
</template>
export class App {
}
<template>
<h2>This is a component with replaceable parts.</h2>
<template replaceable part="repl">This part is replaceable.</template>
</template>
<!doctype html>
<html>
<head>
<title>Aurelia</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</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