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
Asked
Active
Viewed 507 times
-2
-
1google "angularjs + rest github sample" download a project and try. This will be easiest :) – Lyju I Edwinson May 29 '17 at 22:50
-
Thanks it helped – Shashank Shankaranand May 30 '17 at 04:46
1 Answers
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