Getting values from a single document upon click

I have a test meteor app that can be found here:

http://meteorpad.com/pad/ckgN6GL4msQn4Ms5h/Jobs

I have a nav bar, where each item is a document in the Jobs collection.

What I’m wanting to do, is when a user clicks on one of the jobs, the main summary page will show that specific jobs info (name, creation time, user etc.)

I’m trying to achieve this by setting a session variable to the id of that job (this appears to work). Then query from the database and pull the document where the id matches what is stored in the session variable. From that, display the name, creation, username in the summary div

The problem is that nothing appears in the summary div after I click a link

Can anyone see what is wrong with my code? Or, is there a better way to achieve this type of setup?

Close - you’re just missing the {{#with}} in your summary template:

<template name="summary">
  <div id="summaryContainer">
    {{#with summary}}
      <p>Name: {{name}}</p>
      <p>Created at: {{createdAt}}</p>
      <p>Username: {{username}}</p>
    {{/with}}
  </div>
</template>

http://meteorpad.com/pad/h2u5Gd5tLBgtjT2ix/Copy%20of%20Jobs

perfect, thanks!

Is this the correct way to do this type of thing? Or is there something more efficient?

As a small, starting out application this is all fine. Eventually though you’re going to want to consider:

Yes, I hear that last tip is pretty good for building Blaze Apps :stuck_out_tongue_winking_eye:

Well, I guess it’s okay, I mean it’s obviously not going to be as amazing as the “Architectural Tips for people still writing UI in React” post I’m working on. Don’t tell anyone at Workpop that or they’ll steal my idea … oh, wait …