ember.js - In Ember automatically route application to error route if template promise returns error -
given route easy enough ember navigate error route if model promise rejects. have simple method of having error.hbs
, /routes/error.js
, , if model promise errors loads error page.
i have situation model resolves fine, 1 of relationships not. relationship used in routes template e.g.
{{#each model.addresses |address id|}} {{address.line1}} {{/each}}
so myurl.com/api/addresses/1
returns 500 error. see in console window, ember not automatically transition error page. how can promises reject result of template requesting more data?
one solution return rsvp.promise
in route model()
loads data (also relationships instead of lazy loading them later template) , rejects if of asynchronous requests fail.
Comments
Post a Comment