Crossroadsjs routing: how to use it?
By : springbok34
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , Crossroads doesn't handle history/state change events from the browser. From their site: code :
//setup crossroads
crossroads.addRoute('foo');
crossroads.addRoute('lorem/ipsum');
crossroads.routed.add(console.log, console); //log all routes
//setup hasher
function parseHash(newHash, oldHash){
crossroads.parse(newHash);
}
hasher.initialized.add(parseHash); //parse initial hash
hasher.changed.add(parseHash); //parse hash changes
hasher.init(); //start listening for history change
//update URL fragment generating new history record
hasher.setHash('lorem/ipsum');
|
Fixed refresh at top, refresh controllers routes on
By : John Does
Date : March 29 2020, 07:55 AM
hope this fix your issue I have the following HTML structure but I want my refresh button to refresh whatever is current in the view. The view builds different stuff depending on its route. Is this possible to achieve in Angular? , You can use $route.reload method. Consider this demo: HTML: code :
<header>
<button ng-click="refresh()">Refresh</button>
</header>
$scope.refresh = function() {
$route.reload();
};
|
Rebuilding routes after refresh
By : Morten Jakobsen
Date : March 29 2020, 07:55 AM
it helps some times To map an unknown route to a specific page, use the mapUnknownRoutes feature: code :
configureRouter(config, router) {
...
config.mapUnknownRoutes(instruction => {
return 'login';
});
}
export function configure(aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging();
aurelia.start().then(a => a.setRoot());
}
export function configure(aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging();
aurelia.start().then(() => {
if (userIsAuthenticated) {
return aurelia.setRoot('app');
}
if (userPreviouslyAuthenticated) {
return aurelia.setRoot('login');
}
return aurelia.setRoot('landing');
});
}
|
angular4 Routes not being kept on refresh
By : chris
Date : March 29 2020, 07:55 AM
it should still fix some issue Turns out I had a call that would hijack the router and redirect to inject parameters. Before the update this.router.url would return the correct url. Now for some reason it always returns root.
|
Vuex logic with routes and refresh
By : Gökay Umutlu
Date : March 29 2020, 07:55 AM
will be helpful for those in need Create getters in your store that return the state and use mapGetters in your component. while destructuring the desired getters. code :
computed: {
...mapGetters([
'your_getter'
]),
}
|