0

!rant
question
what is Promise in HTTP requests ?
i can't get it

Comments
  • 1
    You probably mean JavaScript promises. Watch this: https://youtu.be/2d7s3spWAzo
  • 3
    A Promise is an object that holds a value from an event that may not have happened yet.

    Http request functions return a promise immediately, and that promise later resolves when the request completes. Instead of using callbacks, you supply a function to the Promise's then method. Example:

    $http.get(url).then(function(response){ ... })

    The get request completes, then your code runs (and is ofc given the http response).

    Simple!
  • 1
    @Ashkin i was understanding it that way. i think im brilliant 😬😬😬😬.
    thnx 😃

    @ctwx it seems like im already understanding . thnx anyway
Add Comment