How to make an HTTP call


I have been following this documentation!#stq=http&stp=1 but am unable to make it work.

I have a application server at http://localhost/testcall which returns a JSON such as this:

{ ‘name’: ‘bob’}

I would like to be able to make a POST call to the server and print this name to the console. May someone please show with a simple example how to make an HTTP request and print it to console (console being on the client side when the response comes back)?



Try this one

          method: 'POST',
          data: JSON.stringify({username:$scope.loginData.username,password:$scope.loginData.password}),
          headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}
            $scope.response = response;

    .post(url, body, options)
        response => console.log(response), 
        err => console.log(error), 
        () => console.log('complete')