Skip to content

Instantly share code, notes, and snippets.

@kasima
Created November 29, 2012 07:33

Revisions

  1. kasima renamed this gist Nov 29, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. kasima revised this gist Nov 29, 2012. 1 changed file with 13 additions and 0 deletions.
    13 changes: 13 additions & 0 deletions with_params.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    Meteor.Router.add({
    '/posts': 'posts',
    '/posts/:id': 'post',
    '/authors/:id': 'author'
    });

    Template.post.post = function () {
    return Posts.findOne(Session.get('params').id);
    };

    Template.author.author = function () {
    return Authors.findOne(Session.get('params').id);
    };
  3. kasima renamed this gist Nov 29, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. kasima created this gist Nov 29, 2012.
    19 changes: 19 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    Meteor.Router.add({
    '/posts': 'posts',
    '/posts/:id': function(id) {
    Session.set('postId');
    return 'post';
    },
    '/authors/:id': function(id) {
    Session.set('authorId', id);
    return 'author';
    }
    });

    Template.post.post = function () {
    return Posts.findOne(Session.get('postId'));
    };

    Template.author.author = function () {
    return Authors.findOne(Session.get('authorId'));
    };