19

As mentioned above, what is the differences between Router.map and Router.route in using meteor iron-router package?
In this tutorial, using 'Router.route'.
But in this tutorial, using 'Router.map'.
So what is the situation that I use 'Router.map' and the case that I use 'Router.route'

ablian
  • 193
  • 1
  • 5

1 Answers1

21

They are different ways of doing the same thing. Router.map is deprecated in the new iron router though, so you should use Router.route (though Router.map would work for the sake of backwards compatibility).

mark
  • 1,725
  • 1
  • 14
  • 14
  • Thanks.You just gave me faith in what I was guessing. – ablian Oct 10 '14 at 02:27
  • No problem, glad I could help! :D – mark Oct 10 '14 at 03:21
  • 1
    thanks mark. I too see posts and how-tos about using router.map. other than posting this on SO, how are we to know that router.map is depreciated? Where is the official Iron Router documentation? the official "guide" is great-in-all, but how are we to dig into the details of the api? are we expected to dig into the code to find our answers? :) – Aaron Oct 14 '14 at 14:41
  • 1
    @Aaron, typically I think the developers make it clear when changes occur in the guide. I guess v1.0.0 of the router isnt yet officially out so that might be a reason for ambiguity. For this particular case, yeah, i just peeked at the source, but it shouldn't be often that this is the case. Sorry I couldn't give a better answer! – mark Oct 14 '14 at 16:08
  • How do you use the {{pathFor}} helper with the new, non-deprecated syntax? – ilrein Feb 04 '15 at 03:37
  • It should be the same as before: `{{pathFor route='routeName'}}`. Check out the guide [here](https://github.com/EventedMind/iron-router/blob/devel/Guide.md#pathfor) if you would like more details. Cheers! – mark Feb 04 '15 at 04:39