You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I try to use object-methods in the route object. The initialization of the objects is in the initialize method. The route-object looks like this:
route: {'path/to/:id': this.object.method{
This causes an Error because the Object doesn't exist at the time of the _bindRoutes() call. Currently I'm using a small Workaroud. I set route in the initialize method and then call _bindRoutes() manually.
The text was updated successfully, but these errors were encountered:
initialization should pretty much always be last. However you may be interested in #3827
In your case though you could define the routes in the initialize using http://backbonejs.org/#Router-route
You could also potentially pass the routes in when instantiating assuming you have the object in question at that point.
Thanks for the response!
I thought in this special case it makes sense to call _bindRoutes after the initialization, because it is something that may depend on the initialize method. If it's a convention always to call it in the end of the constructor I have to do it like you said.
Wouldn't it be better to call _bindRoutes() after the initialization.
I try to use object-methods in the route object. The initialization of the objects is in the initialize method. The route-object looks like this:
This causes an Error because the Object doesn't exist at the time of the _bindRoutes() call. Currently I'm using a small Workaroud. I set route in the initialize method and then call _bindRoutes() manually.
The text was updated successfully, but these errors were encountered: