From cd9a7b9608707c34bec2316ee8c789a617d22a7b Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Thu, 5 Jan 2012 23:03:45 -0800 Subject: fix(ng:repeat): support repeating over array with null typeof null == 'object', but it doesn't behave like an object because its properties can't be dereferenced, so we need to special-case it. Closes #702 --- src/apis.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/apis.js') diff --git a/src/apis.js b/src/apis.js index 6f9b1d0a..7b470802 100644 --- a/src/apis.js +++ b/src/apis.js @@ -14,16 +14,20 @@ * The resulting string key is in 'type:hashKey' format. */ function hashKey(obj) { - var objType = typeof obj; - var key = obj; - if (objType == 'object') { + var objType = typeof obj, + key; + + if (objType == 'object' && obj !== null) { if (typeof (key = obj.$$hashKey) == 'function') { // must invoke on object to keep the right this key = obj.$$hashKey(); } else if (key === undefined) { key = obj.$$hashKey = nextUid(); } + } else { + key = obj; } + return objType + ':' + key; } -- cgit v1.2.3