Skip to content

Instantly share code, notes, and snippets.

@MaximBalaganskiy
Forked from jdanyow/app.html
Created May 7, 2019 02:51
Show Gist options
  • Select an option

  • Save MaximBalaganskiy/0ac69daa2930333a9064242a4f9ff4ab to your computer and use it in GitHub Desktop.

Select an option

Save MaximBalaganskiy/0ac69daa2930333a9064242a4f9ff4ab to your computer and use it in GitHub Desktop.
Aurelia Gist
<template>
<h1>${message}</h1>
<router-view></router-view>
</template>
export class App {
configureRouter(config){
config.map([
{route: ["", "home"], name: "home", moduleId: "home"},
{route: "child", name: "child", moduleId: "child"}
]);
}
message = 'Hello World!';
}
<template>
Child
${params.a}
</template>
export class Child {
activate(params){
this.params = params;
}
}
<template>Home
<button click.delegate="goToChild()">Go To Child</button>
</template>
import {Router} from "aurelia-router";
export class Home{
constructor(router){
this.router = router;
}
static inject = [Router];
goToChild(){
this.router.navigate("child?a=b%26c%2Bd");
}
}
<!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