From b00da987a9e0e4378d8252add8e15ad2e508901d Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Tue, 29 Nov 2011 16:54:25 -0500 Subject: scope($digest): add new&old val to the infinite $digest log --- src/service/scope.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/service/scope.js b/src/service/scope.js index d6cf60c9..dba4de1d 100644 --- a/src/service/scope.js +++ b/src/service/scope.js @@ -323,7 +323,8 @@ function $RootScopeProvider(){ length, dirty, ttl = 100, next, current, target = this, - watchLog = []; + watchLog = [], + logIdx, logMsg; if (target.$$phase) { throw Error(target.$$phase + ' already in progress'); @@ -355,12 +356,13 @@ function $RootScopeProvider(){ watch.last = copy(value); watch.fn(current, value, ((last === initWatchVal) ? value : last)); if (ttl < 5) { - if (!watchLog[4-ttl]) watchLog[4-ttl] = []; - if (isFunction(watch.exp)) { - watchLog[4-ttl].push('fn: ' + (watch.exp.name || watch.exp.toString())); - } else { - watchLog[4-ttl].push(watch.exp); - } + logIdx = 4-ttl; + if (!watchLog[logIdx]) watchLog[logIdx] = []; + logMsg = (isFunction(watch.exp)) + ? 'fn: ' + (watch.exp.name || watch.exp.toString()) + : watch.exp; + logMsg += '; newVal: ' + toJson(value) + '; oldVal: ' + toJson(last); + watchLog[logIdx].push(logMsg); } } } catch (e) { -- cgit v1.2.3