[Answer]-Using promises with directives in angularjs

1👍

Check if this works:

$scope.getGuests = function (guestValue) {
    var promise = $q.defer();
    $http.jsonp('http://gd.geobytes.com/AutoCompleteCity?
    callback=JSON_CALLBACK &filter=US&q=' + guestValue)
    .success(function (response) {
        promise.resolve(limitToFilter(response, 15));
    });
    return promise.promise;
};

Leave a comment