I have an AMD Marionette application with an AppRouter - the AppRouter uses a simple controller object with a set of functions for all the main routes/actions in the application.
In a view, after processing a form submission I want to move the user to a different route.
What is the best approach for sending a user to a new route? Should I be calling methods in my controller directly from the views (if so my controller would be a dependency of the view)? Should I use simply set 'window.location'? Or should I be using an EventAggregator?
If I was to create an EventAggregator in my controller, how would I trigger these events in a view?
I'm following the 'Example with central vent' from the Marionette wiki:
https://github.com/marionettejs/backbone.marionette/wiki/Using-marionette-with-requirejs
window.location
orrouter.navigate(path, {trigger: true})
except for extreme cases. I'm considering having the view trigger an event which the controller can bind to. Similar to the central vent idea but without the need for extending the Controller with an EventAggregator. – Mikel