Created
November 15, 2017 18:18
-
-
Save JeroenVinke/ad9271e0d60516e0d160d7ce47f18fef 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.one-time="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.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('href of first route: ' + this.router.navigation[0].href); | |
| } | |
| activate() { | |
| console.log('activate') | |
| } | |
| bind() { | |
| console.log('bind') | |
| console.log('href of first route: ' + this.router.navigation[0].href); | |
| } | |
| attached(){ | |
| console.log('attached') | |
| console.log('href of first route: ' + 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
| import { Aurelia } from 'aurelia-framework'; | |
| export async function configure(aurelia: Aurelia) { | |
| aurelia.use | |
| .standardConfiguration() | |
| .developmentLogging(); | |
| // Uncomment the line below to enable animation. | |
| // aurelia.use.plugin(PLATFORM.moduleName('aurelia-animator-css')); | |
| // if the css animator is enabled, add swap-order="after" to all router-view elements | |
| // Anyone wanting to use HTMLImports to load views, will need to install the following plugin. | |
| // aurelia.use.plugin(PLATFORM.moduleName('aurelia-html-import-template-loader')); | |
| await aurelia.start(); | |
| await aurelia.setRoot('app'); | |
| } |
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