2016-07-29 11 views

Antwort

4

Hier ist ein Beispiel aus der Dokumentation. Aber um die #hash arbeiten Sie config.options.hashChange als falsch angeben werden müssen:

import {Redirect, NavigationInstruction, RouterConfiguration} from 'aurelia-router'; 

export class App { 
    configureRouter(config: RouterConfiguration): void { 
    config.title = 'Aurelia'; 
    config.options.pushState = true; 

    config.options.root = '/'; 
    config.options.hashChange = false; 

    config.map([ 
     { route: ['welcome'], name: 'welcome',  moduleId: 'welcome',  nav: true, title:'Welcome' }, 
     { route: 'flickr',  name: 'flickr',  moduleId: 'flickr',  nav: true, auth: true }, 
     { route: 'child-router', name: 'childRouter', moduleId: 'child-router', nav: true, title:'Child Router' }, 
     { route: '',    redirect: 'welcome' } 
    ]); 
    } 
} 

Die wichtigen Linien für Ihre Zwecke sind diese zwei:

// switch from hash (#) to slash (/) navigation 
config.options.root = "/"; 
config.options.hashChange = false;