0

I am using Postman extension in Google Chrome to get JSON data. When I pass in a url and use POST and give in the key Authorization and value of an api key I am getting JSON data. I want to do the same through angular so I can use the JSON data and display it on my view.

I am new in angular and don't know how to use the POST method.

DragonBorn
  • 1,809
  • 5
  • 20
  • 44

1 Answers1

1

You can do something like this :

$http.post(url, postData,
{
    withCredentials: true,
    headers:{ 'Authorization': 'Basic' + token} //you add all your headers
}
).then(function(response){ 
   // here you treat your response
  }, function(error){ 
   // here you treat your error 
  }
);
Lotus91
  • 1,127
  • 4
  • 18
  • 31