What controls where Ember's Loading Route is displayed?

前端 未结 4 1815
刺人心
刺人心 2021-01-05 03:41

I would have thought that the LoadingRoute would display its template in the {{outlet}} of the main AppView, but it doesn\'t seem like it does. Wha

4条回答
  •  执笔经年
    2021-01-05 04:25

    If you increase the timeout you will be able to notice that loading template is attached at the end of document. It is probably designed to be used with overlays of fixed positioned elements.

    You can add another outlet (called loading in example below) and force rendering of loading template into it with Route renderTemplate hook:

    App.LoadingRoute = Ember.Route.extend({
        renderTemplate: function() {
            this.render("loading", { outlet: 'loading', into: 'application' });
        }
    });
    

    Check out this example: http://jsbin.com/ipagut/5#/#two

提交回复
热议问题