Pods & Loading/Error Templates


#1

I have created a loading template for my application that is working and I’m now trying to create custom loading templates for my routes and I can’t it to work.

Here is my file structure (using pods).

- app
- | pods
- - | application
- - - - adapter.js
- - - - template.hbs
- - | loading
- - - - template.hbs
- - | author
- - - - model.js
- - - | show
- - - - controller.js
- - - - route.js
- - - - template.hbs
- - - - | loading
- - - - - - template.hbs

Here is my router.js

Router.map(function()
{
  this.route('author.show', { path: '/author/:author_id' });
});

I am using

  • ember 1.13.7
  • ember-cli 1.13.8
  • ember-data 1.13.8

How do I get a custom loading template for my ‘author.show’ route?


#2

Put the “loading” folder containing your loading template.hbs under the “author” level. The loader templates for a route go under its parent level.


#3

SOLVED!

Thanks for the help dan!

I needed to re-organise my router.js to use the parent/child route format:

export default Router.map(function() {
    this.route('author', { path: "authors" }, function() {
    	this.route('list', { path: "list" });
      	this.route('show', { path: ":id" });
    });
});
  • Route: author uses pods/loading
  • Route: author.list uses pods/author/loading
  • Route: author.show uses pods/author/loading

Can't get a loading template to display
#4

Can you show me how do you run the loading template in the route.js file ?

I’m using Ember ver 2.5 and is not working, did you try with the newest version.


#5

When using pods the loading template used is route’s parent.

Example here: https://ember-twiddle.com/ffb3cb5e6418ff89fa3b1d328c2aec76