Created
November 15, 2017 18:16
-
-
Save JeroenVinke/ea6167ccb0e313ba9c4da0cf91a4c534 to your computer and use it in GitHub Desktop.
Aurelia Gist
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> | |
<nav class="navbar navbar-default navbar-fixed-top" role="navigation"> | |
<div class="navbar-header"> | |
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#skeleton-navigation-navbar-collapse"> | |
<span class="sr-only">Toggle Navigation</span> | |
<span class="icon-bar"></span> | |
<span class="icon-bar"></span> | |
<span class="icon-bar"></span> | |
</button> | |
<a class="navbar-brand" href="#"> | |
<i class="fa fa-home"></i> | |
<span>${router.title}</span> | |
</a> | |
</div> | |
<div class="collapse navbar-collapse" id="skeleton-navigation-navbar-collapse"> | |
<ul class="nav navbar-nav"> | |
<li repeat.for="row of router.navigation" class="${row.isActive ? 'active' : ''}"> | |
<a data-toggle="collapse" data-target="#skeleton-navigation-navbar-collapse.in" href.bind="row.href">${row.title}</a> | |
</li> | |
</ul> | |
<ul class="nav navbar-nav navbar-right"> | |
<li class="loader" if.bind="router.isNavigating"> | |
<i class="fa fa-spinner fa-spin fa-2x"></i> | |
</li> | |
</ul> | |
</div> | |
</nav> | |
<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 {Aurelia} from 'aurelia-framework'; | |
import {Router, RouterConfiguration} from 'aurelia-router'; | |
import {PLATFORM} from 'aurelia-pal'; | |
export class App { | |
router: Router; | |
configureRouter(config: RouterConfiguration, router: Router) { | |
config.title = 'Aurelia'; | |
config.options.pushState = true; | |
config.options.root = '/'; | |
config.map([ | |
{ route: ['', 'welcome'], name: 'welcome', moduleId: PLATFORM.moduleName('./welcome'), nav: true, title: 'Welcome' }, | |
{ route: 'users', name: 'users', moduleId: PLATFORM.moduleName('./users'), nav: true, title: 'Github Users' }, | |
{ route: 'child-router', name: 'child-router', moduleId: PLATFORM.moduleName('./child-router'), nav: true, title: 'Child Router' } | |
]); | |
this.router = router; | |
console.log('configureRouter') | |
} | |
created() { | |
console.log('created') | |
console.log(this.router.navigation[0].href); | |
} | |
activate() { | |
console.log('activate') | |
} | |
bind() { | |
console.log('bind') | |
console.log(this.router.navigation[0].href); | |
} | |
attached(){ | |
console.log('attached') | |
console.log(this.router.navigation[0].href); | |
} | |
} |
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
<!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> |
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> | |
<h1>Welcome</h1> | |
</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
export class Welcome { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment