Adam Tuliper
Adam Tuliper

Reputation: 30152

How do you get a Loading template in ember-cli PODS?

I've seen this url Ember-cli Pods & Loading Templates but adding a /app/bugs/loading.hbs or /app/bugs/detail/loading.hbs or even /app/bugs/detail/loading/template.hbs doesn't work.

  1. What is the specific name/path of the template?
  2. Its my understanding loading/error/index routes are generated automatically when you add an additional functions in this.route('bugs', function(){})

I'm missing something probably easy - any thoughts?

Upvotes: 0

Views: 341

Answers (1)

Adam Tuliper
Adam Tuliper

Reputation: 30152

Since the docs don't specifically mention pods and I've seen a few people pose this question on the net using what seems like an older folder structure, I'll answer here.

For my /bugs route I have the following at

./app/bugs/index/route.js
import Ember from 'ember';

export default Ember.Route.extend({
    model() {
        return this.store.findAll('bug');
    },
    actions: {
    loading(transition, originRoute) {
        console.log('loading transition');
        console.log(originRoute);
        //let controller = this.controllerFor('bugs');

        //controller.set('currentlyLoading', true);
        transition.promise.finally(function () {
            console.log('done loading');
            //controller.set('currentlyLoading', false);
        });
      }   
    }
});

The loading template it looks for is located at

./app/bugs/index-loading/template.hbs

Upvotes: 1

Related Questions