This is more of a conceptual/architectural question than anything; the typical/popular approach to constructing and instantiating Backbone Views seems to be to only render the View AFTER successfully fetch
ing necessary Model/Collection data from the server (in a success()
or done()
callback).
This is all well and good, but what if you have some sort of loading indicator or UI element within the View's template that needs to be displayed before/during the fetch
? By not rendering the View until the call finishes, you effectively are unable to display such notifications to the user.
Conversely, if you render the View BEFORE making the fetch
, you're now able to display such UI elements, but you now run the risk of displaying a mostly-empty template, since your Model/Collection data hasn't been retrieved yet, and this can look rather weird.
What if you need both things: UI notifications before/during the fetch
, AND not to render a mostly-empty template pre-fetch
? What might be some good approaches towards accomplishing this goal?