Refreshing a facebook component in meteor


#1

I have a facebook comments widget

<div class="fb-comments" data-href="" data-numposts="5" data-colorscheme="light"></div>

and a template that populates from a mongobd, I use a field called permalinks to create the url.

Router.route('/:permalink', function () {
  this.render('item', {
      // path: '/:permalink',

    data: function(){
        var permalinkVar = this.params.permalink;
        return Items.findOne({permalink: permalinkVar});
      },
    });

});

at present I insert the url (permalink) into the facebook app when the template renders

Template.modal.rendered = function(){
 $('.fb-comments').attr('data-href', window.location.href);
};

However when I navigate through my app

  'click .previous-item' : function(){
     $('.fb-comments').attr('data-href', window.location.href);
      closeMenus();
    },

  'click .next-item' : function(){
     $('.fb-comments').attr('data-href', window.location.href);
      closeMenus();
    },

Because there is no page refresh the app does not populate with the correct comments, if I hit the refresh button it loads properly.

Is there a meteor way to for the facebook widget to load the correct comments.


Re-render a template in meteor
Re-render a template in meteor
#2

I think the Meteor way would be:

<div class="fb-comments" data-href="{{myHelperToGetDataHRef}}" data-numposts="5" 
          data-colorscheme="light">
</div>
Template.myTemplate.helpers({
  myHelperToGetDataHRef: function() {
    // Sorry, I don't use Iron Router...
    return Router.aReactiveIronRouterFunctionThatGivesYouTheCurrentUrl();
  }
});