Last active
May 16, 2016 15:13
-
-
Save charlespockert/b9628a0179c9aeabccd5b32ff972ee95 to your computer and use it in GitHub Desktop.
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
export class AppConfig { | |
routes = [ | |
{ | |
route: [''], | |
name: 'route1', | |
moduleId: './route1', | |
title: 'Route 1' | |
} | |
] | |
} |
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> | |
<router-view></router-view> | |
</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 {inject} from 'aurelia-framework'; | |
import {AppConfig} from './app-config'; | |
@inject(AppConfig) | |
export class App { | |
constructor(appConfig) { | |
this.config = appConfig; | |
} | |
configureRouter(routerConfig, router) { | |
this.router = router; | |
routerConfig.map(this.config.routes); | |
} | |
} |
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
<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://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/jspm_packages/system.js"></script> | |
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/config.js"></script> | |
<script> | |
System.import('aurelia-bootstrapper'); | |
</script> | |
</body> | |
</html> |
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
export class Route1Config { | |
routes = [ | |
{ | |
route: [''], | |
name: 'route2', | |
moduleId: './route2', | |
title: 'Route 2' | |
} | |
]; | |
} |
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> | |
<router-view></router-view> | |
</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 {inject} from 'aurelia-framework'; | |
import {Route1Config} from './route1-config'; | |
@inject(Route1Config) | |
export class Route1 { | |
constructor(route1Config) { | |
this.config = route1Config; | |
} | |
configureRouter(routerConfig, router) { | |
this.router = router; | |
routerConfig.map(this.config.routes); | |
} | |
} |
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 {inject} from 'aurelia-framework'; | |
import {Router} from 'aurelia-router'; | |
@inject(Router) | |
export class Route2Config { | |
} |
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> | |
<span repeat.for="b of breadcrumb">${b.config.name}<span if.bind="!$last"> | </span></span> | |
</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 {inject} from 'aurelia-framework'; | |
import {Route2Config} from './route2-config'; | |
import {Router} from 'aurelia-router'; | |
@inject(Route2Config, Router) | |
export class Route2 { | |
breadcrumb = []; | |
constructor(route2Config, router) { | |
this.configApp = route2Config; | |
this.router = router; | |
} | |
attached() { | |
var inst = this.router.currentInstruction; | |
while(inst) { | |
this.breadcrumb.push(inst); | |
inst = inst.parentInstruction; | |
} | |
this.breadcrumb.reverse(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment