title: Rendering path with Meteor Iron Router
body: <p>I'm implementing <a href="https://github.com/bmcmahen/cast" rel="nofollow">cast.js</a> in Meteor and I'm trying to render a larger photo after clicking on a thumbnail using Iron Router, however I'm having trouble rendering the correct path. The thumbnails render just fine, however when the photo is clicked I'm getting an error of <code>No route found for path:</code>. </p>
  
  <p>The template that I'm using to render each thumbnail photo is </p>
  
  <pre><code>  var renderTemplate = function(obj){
     return "&lt;a href='{{pathFor photo}}'&gt;&lt;img class='img-rounded' src='" + obj.picture + "'&gt;&lt;/a&gt;"
    };
  
    Template.userPhotos.rendered = function(){
      var el = this.find('#cast');
      var mycast = cast(el);
      mycast.draw(renderTemplate);
  
      this.handle = Meteor.autorun(function(){
        var picture = Photos.find().fetch();
        mycast
          .data(picture , '_id')
          .dynamic(150, 150, 10, 10);
      });
    }
  </code></pre>
  
  <p>And is placed within the <code>cast</code> id in this template</p>
  
  <pre><code>&lt;template name="userPhotos"&gt;
    &lt;div class="container"&gt;
      &lt;div class="photos"&gt;
        &lt;div id='cast'&gt;&lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/template&gt;
  </code></pre>
  
  <p>The problem is coming from the href that is rendered. I'm trying to pass the photo <code>_id</code> and render a larger photo in the below template, which is called "source" in mongoDB.</p>
  
  <pre><code>&lt;template name="photo"&gt;
    &lt;div class="well"&gt;
      &lt;img class="img-rounded" src="{{source}}"&gt;
    &lt;/div&gt;
  &lt;/template&gt;
  </code></pre>
  
  <p>Currently, my router is set up as follows:</p>
  
  <pre><code>this.route('photo', {
      path: '/photo/:_id', 
      waitOn: function() {
        return [
          Meteor.subscribe('picture', this.params._id),
        ];
      },
      data: function() { return Photos.findOne(this.params._id); }
    });
  </code></pre>
  
  <p>Once a photo is clicked, it sends me to this path and throws this error <code>Oh no! No route found for path: "/%7B%7BpathFor"</code>. %7B is URL speak for <code>{</code> so it looks like handlebars or Iron Router isn't translating the template when it is passed through as a string. </p>
  
  <p>Any thoughts on how to improve this code? </p>
  
  <p>Thanks in advance!</p>