I have route that has a dynamic segment and provides a model which is loading asynchronously. What I want to do is add a loading view until the model gets resolved. Users enter the route through a link-to helper and so the model context does not always get called.
Anyone knows how I can achieve a loading view in that case?
Time for some code:
// Router
Router.map(function() {
this.route('group', { path: '/tab/:tab_id/group/:group_name' });
this.route('loading');
});
// Group route
export default Ember.Route.extend({
model: function(params) {
return new Ember.RSVP.Promise(function(resolve) {...});
},
serialize: function(model) {
return {
tab_id: model.get('tab').get('id'),
group_name: model.get('name')
};
}
});