We use Backbone and Backbone.Marionette for our project. Currently, we save all of our presentation templates on the server, and we overwrote the loadTemplate call to load them asynchronously.
However, when we use the layout view, since the template for the view is loaded asynchronously, it seems that we cannot immediately access the layout areas. The following is an example:
var layoutView = new Layout(); var itemView = new ItemView(); App.containerRegion.show(layoutView); layoutView.mainRegion.show(itemView); <---- This is where the issue would occur.
If we do not download the template from the server asynchronously, it will work fine. What would be a good way to implement this? We want to save templates on the server, and not download everything at once. We also want to avoid being tied to the rendering event of the layout view throughout our code.
thanks
source share