diff options
| author | Igor Minar | 2011-11-29 16:54:25 -0500 | 
|---|---|---|
| committer | Igor Minar | 2011-11-30 14:49:35 -0500 | 
| commit | b00da987a9e0e4378d8252add8e15ad2e508901d (patch) | |
| tree | 568629de5e9200075d9b138773c3ec4c2f562c2f /src | |
| parent | 188bdf7768c9594a01a18abae3fa9a3114802508 (diff) | |
| download | angular.js-b00da987a9e0e4378d8252add8e15ad2e508901d.tar.bz2 | |
scope($digest): add new&old val to the infinite $digest log
Diffstat (limited to 'src')
| -rw-r--r-- | src/service/scope.js | 16 | 
1 files changed, 9 insertions, 7 deletions
| 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) { | 
