Automatic promise unwrapping in template?

I remember reading this somewhere before that Ember allows object properties to be set as a promise and the resolved value will get rendered into the template.

Did I do something wrong here?

The templates don’t work with promises directly, they work with object proxies. You need to use a PromiseObject or PromiseArray, which have proxy functionality mixed in so the templates do update when the promise resolves.

But in your example, you don’t really need this, as Ember routing takes care of that for you. If you return a promise from the model hook of your ApplicationRoute, Ember will wait until the promise resolves before setting the model on your controller.

Here is an example of how to use a PromiseObject Edit fiddle - JSFiddle - Code Playground (adapted based on https://github.com/emberjs/data/blob/52114c36457b73ed880562b4595482d8576f5826/packages/ember-data/lib/system/store.js#L1622)

Ah, I see.

Thanks for all the responses! Even though that left me a bit disappointed. :frowning:

Another approach without using PromiseObject instead a computed that wraps a Promise.

Edit fiddle - JSFiddle - Code Playground not exactly production-ready code… but it illustrates the idea.