So then in your template, if you access posts within the template it will loop through all posts created by the same author as the main one you’ve loaded. Do this with:
Just one question so i might learn something here, template helpers gets access to all the data that i bring in from other sources(iron router here) into that template?
If the above is true how does it know that with this it should refer to data method from the iron:router, what if i had a data2 method aswell.
Or just point me into the right direction so that I can go read about it, really interested to learn this stuff.
The iron router guide is quite thorough, have a look through there to get a better understanding.
I believe the answer to your question is that if you just create a data2 hook, that isn’t going to be recognised by the router. The data hook is special and that is where the scope for the template comes from…
It seems “this”, console.log(this), doesn’t refere to the data from the iron:router in Template.created but to the Blaze components, so how do we access it?
In Template.event console.log(this) is the document I want, but I can’t use it here since I have to set session on the beginning, really confused how this works.
Answer lies in Template.currentData(); but i still don’t get it why “this” means 2 different things in template.created and template.events.
One more thing, in the docs it says I should use onCreated and onRendered but this doesn’t work for me, I have to use created and rendered. Using windows 0.3.0.
Yeah that was a change in the recent update. I think the rational was that this allows multiple packages to use the template hooks without interfering with each other.