angularjs - Angular.js: Cannot read cookie in http.post response -


i'm aware issues similar have been covered elsewhere i'm still unable working in code.

i cannot read http post response cookie value using angular.js though cookie present in (successful) post response. cookie can viewed using chrome devtools in response headers (in 'set-cookies') , in 'response cookies' in 'cookies' tab.

the following factory makes http post (coffeescript):

.factory "authpost", ($http) ->   url = 'http://10.x.y.z/api/authentication/authenticate'   login: (credentials) ->     $http.post(       url,        $.param(credentials),       headers: 'content-type': 'application/x-www-form-urlencoded'     ) 

it's called in controller function:

authpost.login(credentials).success(success).error error 

in 'success' function in controller, $cookies undefined though:

success = (data, status, headers, config) ->   $timeout (->     console.log ('after timeout $cookies=' + $cookies)     return   ), 100 

any ideas why $cookies undefined?

or should approach differently? there (better) alternative reading cookie value in 'set-cookies' value in response header?


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -