Answer the question
In order to leave comments, you need to log in
How to decouple Backbone Router and Controller in RequireJS modules?
SPA refactoring, a cyclic dependency has arisen.
There is a Controller module, where all the logic and actions in the application, incl. display view "pages". And there is a separate Backbone Router module responsible for navigation.
When the application is initialized, depending on the received initial data, the Controller directs to one or another "page" displays the corresponding. view and includes resp. URL in Router.
When navigating menus in an application, Router jumps to some “pages” by calling the Controller.go(page) method or performs other actions from the Controller, such as refreshing data from the server.
How to properly decouple these two modules so that maybe only one depends on the other? Throw in the opposite direction Event'y?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question