I used the timeout solution in Angular 1.2.8 and it worked. I immediately upgraded my Angular version to 1.3.14 and it is broken :( Does any one know a fix ?
On Tuesday, August 19, 2014 at 1:38:57 PM UTC-4, Elizabeth Bastian wrote: > > I know this is old but I just ran into this and the $timeout workaround > works perfectly for me. I'm using the latest version of angular. Is this > something that is going to be changed eventually? Or has anybody found > another way around this? > > On Wednesday, January 15, 2014 1:10:58 PM UTC-6, Seth Martin wrote: >> >> The solution I chose to use based on the information found here >> <https://github.com/angular/angular.js/blob/1bb33cccbe12bda4c397ddabab35ba1df85d5137/src/ngCookies/cookies.js#L58-L66> >> and here >> <https://github.com/angular/angular.js/blob/1bb33cccbe12bda4c397ddabab35ba1df85d5137/src/ng/browser.js#L102>. >> >> Tells me that the $cookies will attempt to refresh every 100ms. So with >> this information in mind you can add a $timeout to any request that needs >> to use the response cookies. >> >> $http.post('/wms/x-services/signin', tokens) >> .success(function(result, status, headers, config) { // sign in successful >> $timeout(function() { /* do stuff with $cookies here. */ }, 100); >> }) >> .error(function(data, status, headers, config) { >> }); >> >> On Wednesday, January 15, 2014 12:32:28 PM UTC-5, Seth Martin wrote: >>> >>> inside the success handler of a post(), $cookies returns old cookie >>>> value >>>> >>> >>> This is the problem that I am having as well. There is something that I >>> am missing. Does anyone have any ideas? I am using version 1.2.6 >>> >>> $http.post('/wms/x-services/signin', tokens) >>> .success(function(result, status, headers, config) { // sign in >>> successful >>> // do stuff with $cookies -- but the $cookies are not updated with the >>> response >>> }) >>> .error(function(data, status, headers, config) { >>> }); >>> >>> On Thursday, October 17, 2013 3:13:23 PM UTC-4, Alec Lebedev wrote: >>>> >>>> Unfortunately, this is still a problem in Angular 1.2.0-RC2. >>>> >>>> In general, I can manage cookies using $cookies just fine. However, >>>> inside the success handler of a post(), $cookies returns old cookie value, >>>> and not the new value from the post response. >>>> >>>> Alec >>>> >>> -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
