Skip to content

Instantly share code, notes, and snippets.

@reneolivo
Forked from JeroenVinke/app.html
Last active May 12, 2020 12:51
Show Gist options
  • Save reneolivo/923920bcb56e0e4709954c93e5bece87 to your computer and use it in GitHub Desktop.
Save reneolivo/923920bcb56e0e4709954c93e5bece87 to your computer and use it in GitHub Desktop.
Aurelia Templating Child/Children Bug
<template>
<h1>Bug Example</h1>
<router-view></router-view>
</template>
export class App {
configureRouter(config, router) {
config.map([
{ route: '', name: 'home', moduleId: 'home' }
]);
}
}
<template>
<h3>Custom Container</h3>
<small>(Custom Element Component)</small>
<hr />
<require from="./custom-title.html"></require>
<custom-title>Custom Title</custom-title>
</template>
import {child} from 'aurelia-framework';
export class CustomContainer {
@child('custom-title') customTitle;
attached() {
console.log('The Custom Title Element: ', this.customTitle);
}
}
<template>
<h4><slot></slot></h4>
<small>(Custom Element Component)</small>
</template>
<template>
<h2>Home</h2>
<small>(Router Component)</small>
<hr />
<require from="./custom-container"></require>
<custom-container></custom-container>
</template>
import {child} from 'aurelia-framework';
export class Home {
@child('h2') title;
@child('custom-container') customContainer;
attached() {
console.log('The Title Element: ', this.title);
console.log('The Custom Container Element: ', this.customContainer);
}
}
<!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">
</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