Im sure this is a newbie question but, oh, for the life of me my dearest friends, i cannot fathom a solution. Please help out:
This is my route:
Router.route(’/ottedit/:_id’, {
name: ‘ottedit’,
path:’/ottedit/:_id’,
template:‘ottedit’,
data: function() { //never seen this called by the way
console.log(‘hullo’+this.params);
return OTTs.findOne({_id: this.params._id });
},
action: function () {
this.render(‘ottedit’);
}
});
And its OKAY. My template is named <template name="ottedit">, i make links with {{pathFor ottedit}} which gives me nice ottedit/LonGIDStuff1234 and it all looks good except…
(sniff)… :~(
When clicking on that ottedit link, this thing says: Couldn’t find a template named “ottedi” or “ottedi”. Are you sure you defined it?
And by Odin, yeah man, like, im pretty sure. If I add TWO letter 't’s to my path, THEN it works: (so otteditt/blahblah does find the ottedit template! )
So it feels like many people should have hit this newb problem. Please help out or well, continue to watch me from above and judge me. By the gods i will solve it one day.
I did, and im seeing the same thing. My data function is exactly the same as the one you post, I just didnt enclose my code in backticks (still learning here).
I dont know… maybe im in the wrong router version?
This is my meteor list output for iron:
iron:router 1.0.7 Routing specifically designed for Meteor
And then my URLs are very nice: http://localhost:3000/ottedit/MopSRdsRJKiF5B92f . And the strange error is: cannot find “ottedi” or “ottedi”… aint that the freakyest? If i edit directly my url to say otteditt (with two letter t’s, then it works!).
Even weirder. If I leave everything as is, but change my template to <template name="hell">, then it “works” although the data function never gets executed. … hum… maybe im not configured to even run the iron router?
I really like flow-router for its simplicity, is made for what it is, create routes
routes run only once and not notice unnecessary renderings
I fought many times about my publications because they are called a lot and now I make sure that only called 2 times, once with fast-render and again from the client, and if you change your route only call a single time
this does not mean that Iron-router is evil, just that I’m more comfortable with Flow-router because Iron-router has a lot of things that never really use.