What controls where Ember's Loading Route is displayed?

前端 未结 4 1817
刺人心
刺人心 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:01

    Indeed it looks that it is inserted right before the closing tag of the tag with class ember-application. You can control to which outlet it is inserted using renderTemplate:

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

    Then place the loading outlet wherever you want in the application template:

    
    

    Note that the name of the default outlet (i.e., {{outlet}}) is main. But trying to use the default outlet for rendering the App.LoadingView creates problems.

    Demo: http://jsbin.com/asizim/2/

提交回复
热议问题