Cannot call method 'then' of undefined
angularjs
Solution
I saw your plunk and there is a minor error. I am giving the corrected plunker. http://plnkr.co/edit/vRuA5Vy8sT6BhzsaYTkl?p=preview
doSomething : function() {
//your method isn't returning anything
return $http().then();
}
Problem
Why am I getting 'cannot call method 'then' of undefined': http://plnkr.co/edit/yWS6hRjmZZeZMJyVA0zy?p=preview Can you not resolve a promise inside the .then of another promise? The code works fine if you take out the call to doSomething(), and it gets the suburbs, but as soon as you add the call to doSomething() it fails with that .then undefined error. The call to doSomething also works if it's outside of the .then for the requests to get the suburbs, so that's why I'm lead to believe it's something to do with it being embedded. Thank you