Skip to content

Instantly share code, notes, and snippets.

@Vheissu
Forked from haiau79/app.html
Last active April 28, 2016 00:04
Show Gist options
  • Save Vheissu/cc434c782389388e254101540827ce42 to your computer and use it in GitHub Desktop.
Save Vheissu/cc434c782389388e254101540827ce42 to your computer and use it in GitHub Desktop.
Navigate Route
<template>
</template>
import {inject} from 'aurelia-framework';
import {Router} from 'aurelia-router';
@inject(Router)
export class App {
configureRouter(config, router) {
console.log(router);
config.title = 'App';
config.map([
{
route: 'customise/:companyId/:reportId/:periodId',
name: 'customise',
moduleId: './customise',
title: 'Customise',
auth: true
}
]);
setTimeout(() => {
window.alert('Yes');
router.navigateToRoute('customise', {
companyId: 1234,
reportId: 1234,
periodId: 1234
});
}, 3000);
this.router = router;
}
}
<template>
<h1>Customise</h1>
</template>
export class Customise {
canActivate(params) {
window.alert('Can Activate');
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(true);
}, 5000);
});
}
attached() {
window.alert('Attached');
}
}
<!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