Created
March 12, 2017 19:41
-
-
Save claudiobernasconi/26754dcec3bd33ee357e1222d18e13ac to your computer and use it in GitHub Desktop.
This gist demonstrates how the router.navigation property in the navigation.ts view does not work as expected when the router property type on the app.ts viewModel is set to any.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<require from="bootstrap/css/bootstrap.css"></require> | |
<require from="./header"></require> | |
<require from="./navigation"></require> | |
<div style="margin-top: 60px;"> | |
<navigation></navigation> | |
<div id="master" style="margin-left:250px;padding-left:10px;border-left: 1px solid #000000;"> | |
<div class="alert alert-success" role="alert"><b>Well done!</b> You successfully read this important alert message.</div> | |
<header></header> | |
<router-view></router-view> | |
</div> | |
<div class="clear" style="clear:both;"></div> | |
</div> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Router} from 'aurelia-router'; | |
export class App { | |
router: Router; /* change the type of this variable to any and it won't work in navigation.ts */ | |
configureRouter(config, router){ | |
config.title = "Aurelia"; | |
config.options.root = '/'; | |
config.map([ | |
{ route: ["", "login"], name: "login", moduleId: "login", nav: false}, | |
{ route: "batch/overview", name: "overview", moduleId: "overview", title: "Übersicht", nav: true}, | |
{ route: "batch/completed-jobs", name: "completed-jobs", moduleId: "completed-jobs", title: "Abgeschlossene Jobs", nav: true}, | |
{ route: "batch/job-definitions", name: "job-definitions", moduleId: "job-definitions", title: "Job Definitionen", nav: true}, | |
]); | |
this.router = router; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment