From 7da2bdb82a72dffc8c72c1becf6f62aae52d32ce Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Sat, 21 Jan 2012 00:01:44 -0800 Subject: [PATCH] fix(scope): support watching functions currently we run into infinite digest if a function is being watched as an expression. This is because we generate bound function wrapper when the watch is processed via parser. I'm not too keen on the solution because it relies on the unbound fn that is being exposed for other reasons, but I can't think of a better way to deal with this right now --- src/Angular.js | 39 +++++++++++++++++++++------------------ test/service/scopeSpec.js | 16 ++++++++++++++++ 2 files changed, 37 insertions(+), 18 deletions(-) diff --git a/src/Angular.js b/src/Angular.js index 3f272ec29b20..17ede3aa5c23 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -655,28 +655,31 @@ function equals(o1, o2) { if (o1 === null || o2 === null) return false; if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN var t1 = typeof o1, t2 = typeof o2, length, key, keySet; - if (t1 == t2 && t1 == 'object') { - if (isArray(o1)) { - if ((length = o1.length) == o2.length) { - for(key=0; key