bafrick bafrick - 4 months ago 13
Node.js Question

Populating a text box with parameter in meteor iron router

So I have a meteor route set up like so:

Router.route('/joinRoom/:_id', function () {

and a simple html template:

<template name="joinRoom">
<p>Enter Your Room ID</p>
<input placeholder="1" type="text" class="joinID">
<button class="submit" type="submit" value="submit">Join Room -></button>

And I want to populate the data passed in as the
parameter to be the text inside the

I tried looking over Iron Router's documentation, but I couldn't figure it out. How do I do this?


You can use Router.current().params in your helpers to get the parameters from the url.

<input placeholder="1" type="text" class="joinID" value={getId}>


getId: function () {
  var params =  Router.current().params;
  return params && params._id ? params._id : '';