-2

https://jsonplaceholder.typicode.com/posts I have to fetch data from this link and display it in my browser. In Javascript I used to do it using XMLHttpRequest and then parse it using JSON.parse(response). Is there a way I can achieve something similar in angularjs. Thank you

1 Answers1

1

You can review this link angular http get

sample

 $http({
     method: 'GET',
       url: '/someUrl'
   }).then(function successCallback(response) {
      // this callback will be called asynchronously
        // when the response is available
   }, function errorCallback(response) {
/ / called asynchronously if an error occurs
   // or server returns response with an error status.
});
Onur Önder
  • 311
  • 1
  • 7
  • 20
  • It's usually worth pointing out to beginners that the response data is in `response.data` – Phil May 30 '17 at 00:04