javascript - How to send cookie in each request header in angularjs? -


hi in developing angularjs web application. using api's data. on login successful data in cookie(response header). in next subsequent http calls need send cookies data apis. below snapshot of response header.

response header cookie

below sample $http call.

var req = {               method: 'post',               url: savepersonaldetailsurl,               headers: {               requestedplatform: "web",               requestedlanguage: cookiepreferredlanguage               },   data:      {              loginid: loginid              }    $http(req).then(function (response) {    //do here   }, function (error) {      toastr.error($filter('translate')('error occured'));      }); 

on each http call want send cookie in header. may know how can done in angularjs? appreciated. thank you.

one of features of cookies they're sent server each request. make sure domain request being made same domain set or sub domain.

the cookie stored browser, , cookie sent requests made same server inside cookie http header - https://developer.mozilla.org/en-us/docs/web/http/cookies


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -