Problem with Promises


#1

After watching the excellent video posted recently on using Promises I’m now trying to follow the advice and use them on a project.

I have made an extremely trivial (and hopefully clear) jsbin link of the issue I have come across which is proving hard for me to debug.

Once a promise is resolved I am unable to call other functions from within the then resolve or reject methods…

I’d really appreciate some help on this as it is causing me some serious grief & i’ve been unable to find any documentation on it via google.

Thanks!

JSBIN example

Ember - Problem With Promises


#2

Inside your then of the promise, you’ve switched contexts, hence the context of ‘this’ is no longer pointing at your index controller. You also are trying to access a property like a method. You need to use the getter while accessing properties.

jsbin


#4

Thank you for the clear explanation - it has helped my understanding & I am now making some good progress.