diff options
| author | Igor Minar | 2010-09-25 15:29:48 -0700 | 
|---|---|---|
| committer | Igor Minar | 2010-09-26 23:54:31 -0700 | 
| commit | 3eec8c1a517f8b93a5afd15b7f83b33c5df7e54b (patch) | |
| tree | 9d9574d2245257456966bb0d15853f8f0d620958 /src/services.js | |
| parent | 9171a2b2b50d0a8217c98e0017a7d2a0a1a37380 (diff) | |
| download | angular.js-3eec8c1a517f8b93a5afd15b7f83b33c5df7e54b.tar.bz2 | |
Properly initialize cookie service in order to preserve existing cookies
- previously the poller initialized the cookie cache too late which
  was causing previously existing cookies to be deleted by cookie service
- refactored the poller api so that the addPollFn returns the added fn
- fixed older cookie service tests
- removed "this.$onEval(PRIORITY_LAST, update);" because it is not needed
Diffstat (limited to 'src/services.js')
| -rw-r--r-- | src/services.js | 7 | 
1 files changed, 4 insertions, 3 deletions
diff --git a/src/services.js b/src/services.js index ddeebe1f..56637573 100644 --- a/src/services.js +++ b/src/services.js @@ -409,16 +409,17 @@ angularService('$cookies', function($browser) {        rootScope = this,        lastCookies; -  $browser.addPollFn(function(){ +  //creates a poller fn that copies all cookies from the $browser to service & inits the service +  $browser.addPollFn(function() {      var currentCookies = $browser.cookies();      if (lastCookies != currentCookies) {        lastCookies = currentCookies;        copy(currentCookies, cookies);        rootScope.$eval();      } -  }); +  })(); -  this.$onEval(PRIORITY_FIRST, update); +  //at the end of each eval, push cookies    this.$onEval(PRIORITY_LAST, update);    return cookies;  | 
