How do i get data from JSON?
for example.
I want to request ID number 1, and show their data?
https://jsonplaceholder.typicode.com/users
Thanks!!
How do i get data from JSON?
for example.
I want to request ID number 1, and show their data?
https://jsonplaceholder.typicode.com/users
Thanks!!
Hi @jaisinamban
You can include this code in your controller.
.controller('UserCtrl', function($scope, $http) {
var url = 'https://jsonplaceholder.typicode.com/users?id=1';
$http({
url:url,
method:"GET",
})
.success(function(Data, status, header, config){
$scope.userList = Data;
})
.error(function(Data, status, header, config){
alert('error');
});
});
NOTE: I have added query string at the end of string ( ?id=1 ) for getting the data of only ID number 1.
Hope this will help you.