Skip to content

Instantly share code, notes, and snippets.

@jwx
Created December 23, 2020 00:44
Show Gist options
  • Save jwx/9afa4e2fe074c51034edc44376664ad4 to your computer and use it in GitHub Desktop.
Save jwx/9afa4e2fe074c51034edc44376664ad4 to your computer and use it in GitHub Desktop.
Test
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Dumber Gist</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
<base href="/">
</head>
<!--
Dumber Gist uses dumber bundler, the default bundle file
is /dist/entry-bundle.js.
The starting module is pointed to "main" (data-main attribute on script)
which is your src/main.js.
-->
<body>
<my-app></my-app>
<script src="/dist/entry-bundle.js" data-main="main"></script>
</body>
</html>
{
"dependencies": {
"aurelia": "dev"
}
}
I want to load when I visit parent.
export class Child {}
export class Home {}
import Aurelia, { RouterConfiguration } from 'aurelia';
import { MyApp } from './my-app';
Aurelia
.register(RouterConfiguration.customize({ useUrlFragmentHash: false }))
.app(MyApp)
.start();
<import from="./home"></import>
<import from="./parent"></import>
<nav>
<a load="home">Home</a>
<a load="parent">Parent</a>
</nav>
<au-viewport name="main" default="home"></au-viewport>
export class MyApp {
static routes = [
{ path: "home", instructions: [{ component: "home" }] },
{ path: "parent", instructions: [{ component: "parent" }] },
{ path: "parent/child", instructions: [{ component: "child" }] }
]
}
<import from="./child"></import>
I am Parent
<au-viewport name="parent" default="child"></au-viewport>
export class Parent {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment