mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-24 03:55:49 +08:00
$cookie factory fn should not run $eval
This commit is contained in:
@@ -16,7 +16,8 @@ angularServiceInject('$cookies', function($browser) {
|
||||
var rootScope = this,
|
||||
cookies = {},
|
||||
lastCookies = {},
|
||||
lastBrowserCookies;
|
||||
lastBrowserCookies,
|
||||
runEval = false;
|
||||
|
||||
//creates a poller fn that copies all cookies from the $browser to service & inits the service
|
||||
$browser.addPollFn(function() {
|
||||
@@ -25,10 +26,12 @@ angularServiceInject('$cookies', function($browser) {
|
||||
lastBrowserCookies = currentCookies;
|
||||
copy(currentCookies, lastCookies);
|
||||
copy(currentCookies, cookies);
|
||||
rootScope.$eval();
|
||||
if (runEval) rootScope.$eval();
|
||||
}
|
||||
})();
|
||||
|
||||
runEval = true;
|
||||
|
||||
//at the end of each eval, push cookies
|
||||
//TODO: this should happen before the "delayed" watches fire, because if some cookies are not
|
||||
// strings or browser refuses to store some cookies, we update the model in the push fn.
|
||||
|
||||
Reference in New Issue
Block a user