Although I don't know what your locationRepository
looks like, it appears it returns a promise, because you're then
-ing it. In this then
you return the location array.
But you're forgetting to return the promise at
$scope.getOriginSuggestions = function (locationType, phrase) {
locationRepository.searchByType(locationType, phrase)
// (...)
You'll need to return it. ( As they do in the example )
$scope.getOriginSuggestions = function (locationType, phrase) {
return locationRepository.searchByType(locationType, phrase)
// (...)