Open boustanihani opened 9 years ago
Happy new year first :)
I just noticed that calling Router.current().url for the first time returns the absulute URL of a route, whereas any further calls will only return the path.
Router.current().url
Reproduction: http://router-current-url.meteor.com/myroute Notice how the value changes when switching between "Home" and "My route" after the first load...
Repository: https://github.com/boustanihani/router-current-url
<template name="defaultLayout"> <h3>Default layout</h3> <nav> <a href="/">Home</a> <a href="/myroute">My route</a> </nav> <br> <div> <span>Router.current().url = <strong>{{currentUrl}}</strong></span> </div> <br> <div style="padding:1em;border:solid;"> {{> yield}} </div> </template> <template name="home"> <h3>Home</h3> </template> <template name="myroute"> <h3>My route</h3> </template>
Router.configure({ layoutTemplate: 'defaultLayout', }); Router.route('/', { template: 'home' }); Router.route('/myroute', { template: 'myroute' }); if (Meteor.isClient) { Template.registerHelper('currentUrl', function() { console.log('Router.current().url=' + Router.current().url); return Router.current().url; }); }
I'm experiencing the same issue.
Same issue here. Is there a fix for this?
Happy new year first :)
I just noticed that calling
Router.current().url
for the first time returns the absulute URL of a route, whereas any further calls will only return the path.Reproduction: http://router-current-url.meteor.com/myroute Notice how the value changes when switching between "Home" and "My route" after the first load...
Repository: https://github.com/boustanihani/router-current-url