Iron Router eats last letter of my path?

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’,
data: function() { //never seen this called by the way
return OTTs.findOne({_id: this.params._id });
action: function () {

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.

Try using this route

Router.route('/ottedit/:_id', {
  name: 'ottedit',
  data: function () {
    return OTTs.findOne({_id: this.params._id });

Thank you for your quick reply M(s)r cottz!

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

the error remains the same?

Couldn’t find a template named “ottedi” or “ottedi”. Are you sure you defined it?

according to that error it is possible that in your actual path you forgot to put a letter

I know it seems that should be the case, but im pretty sure I didnt! Verbantim:

Router.route('/ottedit/:_id', {
  name: 'ottedit',
  data: function () {
    return OTTs.findOne({_id: this.params._id });

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!).

so… if you put a different path name (and template) such as “hello”, it works well?

I had some 40+ router in Iron router, but I pass after discovering Flow-router

Check it out! GAArrrrr:

Couldn’t find a template named “hell” or “hell”. Are you sure you defined it?

Router.route('/hello/:_id', {
  name: 'hello',
  data: function () {
    return OTTs.findOne({_id: this.params._id });

URL is:

<a href="{{pathFor 'hello'}}">edit<i class="right floated edit icon"></i></a>

Shows as: http://localhost:3000/hello/MopSRdsRJKiF5B92f

Template is declared as: <template name="hello">

Man… hahahaha… its funny… hello -> hell

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?

Well thatl teach me to meddle in things I dont understand. I had the sacha:aurouter package installed… :confused:

hi @cottz can you tell us more about why you prefer Flow router?


Maybe you installed the iron:route package instead of iron:router? :slight_smile:

1 Like

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.

1 Like

+1. And it has really simple middlewares and awesom features like Router.setParam()