-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
accessing router initialize parameters from the route callback? #49
Comments
You should be able access it with:
Here's a functional example in CoffeeScript - different syntax, same principle:
|
Hi @aeksco, sorry I got carried away and forgot critical details that I'm both using marionette and Marionette.Subrouter https://github.com/pushchris/backbone.marionette.subrouter ... which both are supposed to be extensions but anyways, I understand why this works in your example and also see now why it doesn't work in mine (below) but I still would love to find a solution.
Marionette Router derived from Backbone Router and Marionette SubRouter derives from AppRouter but clearly there's a ton of more things happening. In my case using appRoutes
I guess this is a Marionette question |
Interesting - wasn't familiar with Marionette.Subrouter. Learning new things everyday :D Superficially the issue you're experiencing appears to be a result of your method not being properly bound to the subrouter instance. For example, you have:
Where you really need:
If I'm not mistaken, the above is typically going to be used when the method you're defining is a callback that references instance fields in the parent object. The distinction in CoffeeScript is terse and fails to clarify the underlying principles, though researching the nuances between thin arrows and fat arrows will shed some light on your dilemma, given of course that the rest of the code is functioning well.
VS
Hope this helps - good luck! |
I saw you can pass parameters to your subroute like so
Then retrieve it from the SubRoute like so
Now given my subroute, how can I access
locale
andisVIP
from my subroute callbackmycallback()
?The text was updated successfully, but these errors were encountered: