Meteor|iron-router|what is the differences between Router.map and Router.route
Asked Answered
P

1

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'

Putrefy answered 10/10, 2014 at 1:33 Comment(1)
@abian, can you mark the answer given as the answer?Greyhound
C
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).

Cuyp answered 10/10, 2014 at 2:21 Comment(5)
Thanks.You just gave me faith in what I was guessing.Putrefy
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? :)Countersink
@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!Cuyp
How do you use the {{pathFor}} helper with the new, non-deprecated syntax?Numberless
It should be the same as before: {{pathFor route='routeName'}}. Check out the guide here if you would like more details. Cheers!Cuyp

© 2022 - 2024 — McMap. All rights reserved.