In one route I render multiple outlets, and foreach outlet I load its content using the its controller with the content
variable. I would like to show a loading view for each outlet, but don't know how to since there are no loading route for them (and so I can't just create an handlebar).
I have no issue displaying the loading view when my app starts, using a loading
handlebar. But for my outlets I have no routes neither resources to it, so there is no loading route or loading template available when checking the Ember console.
I need to find a trick so I can, in my outlet, display a loading view while the content
is being fetched.
Any idea?
The route where I'm inserting the outlet:
App.ProfileRoute = Ember.Route.extend({
renderTemplate: function() {
this.render(); // default behavior, renders the default template
// loads documents outlet
this.render('documents', {
into: 'profile',
outlet: 'documents',
controller: 'documents'
});
// load other outlets after
}
});
The associated handlebar:
<script type="text/x-handlebars" data-template-name="profile">
<div id="profile-sections">
{{outlet documents}}
{{outlet accounts}}
{{outlet contacts}}
</div>
</script>
Controller:
App.DocumentsController = Ember.ArrayController.extend({
itemController: 'document',
content: function () {
return this.store.findAll('document');
}.property()
});
Then, in the documents.hbs template I just loop over the documents, link them to the item controller, and have my logic. That's all. I've tried to add the loading
function into the actions
of the controller, but it didn't work (just logged some text but nothing showed up).
Thanks,