Skip to content

Instantly share code, notes, and snippets.

@fkleuver
Forked from jwx/index.html
Last active September 26, 2020 23:50
Show Gist options
  • Save fkleuver/e63198991ebe59dfbea8e7d726f94a64 to your computer and use it in GitHub Desktop.
Save fkleuver/e63198991ebe59dfbea8e7d726f94a64 to your computer and use it in GitHub Desktop.
Multiple viewports with separate navigation
<!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.ts.
-->
<body>
<my-app></my-app>
<script src="/dist/entry-bundle.js" data-main="main"></script>
</body>
</html>
{
"dependencies": {
"aurelia": "dev"
}
}
<import from="./detail.html"></import>
<import from="./edit.html"></import>
This is feature 1's child 1
<au-viewport default="detail" used-by="detail,edit"></au-viewport>
Feature 1 child1 Detail<br>
<a goto="../edit">Edit</a>
Feature 1 child1 Edit<br>
<a goto="../detail">Back</a>
<import from="./detail.html"></import>
<import from="./edit.html"></import>
This is feature 1's child 2
<au-viewport default="detail" used-by="detail,edit"></au-viewport>
Feature 1 child2 Edit<br>
<a goto="../detail">Back</a>
Feature 1 child2 Detail<br>
<a goto="../edit">Edit</a>
<import from="./child1/child1.html"></import>
<import from="./child2/child2.html"></import>
This is feature 1
<au-viewport default="child1" used-by="child1" class="feature"></au-viewport>
<au-viewport default="child2" used-by="child2" class="feature"></au-viewport>
Feature 2 Detail<br>
<a goto="../edit">Edit</a>
Feature 2 Edit<br>
<a goto="../detail">Back</a>
<import from="./detail.html"></import>
<import from="./edit.html"></import>
This is feature 2
<au-viewport default="detail" used-by="detail,edit"></au-viewport>
import Aurelia, { RouterConfiguration } from 'aurelia';
import { MyApp } from './my-app';
Aurelia
.register(RouterConfiguration)
.app(MyApp)
.start();
au-viewport {
display: block;
padding: 5px;
}
au-viewport.feature {
border: 1px solid black;
}
<import from="./feature1/feature1.html"></import>
<import from="./feature2/feature2.html"></import>
<h1>${message}</h1>
<au-viewport name="feature1" default="feature1" used-by="feature1" class="feature"></au-viewport>
<au-viewport name="feature2" default="feature2" used-by="feature2" class="feature"></au-viewport>
export class MyApp {
public message: string = 'Hello, Aurelia 2';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment