Skip to content

Instantly share code, notes, and snippets.

@paulmolluzzo
Created August 7, 2014 01:14
Show Gist options
  • Save paulmolluzzo/559d44ce5e78226d702b to your computer and use it in GitHub Desktop.
Save paulmolluzzo/559d44ce5e78226d702b to your computer and use it in GitHub Desktop.
URL Encoding Helper for Meteor
UI.registerHelper('escapeURL', function(route, id) {
var path = Meteor.absoluteUrl() + Router.routes[route].path({_id: id}).substring(1);
return encodeURIComponent(path);
});
<template name="whatever">
{{#each thing}}
<a href="{{escapeURL 'routeName' this._id }}">Link to Escaped URL</a>
{{/each}}
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment