aboutsummaryrefslogtreecommitdiffstats
path: root/src/apis.js
diff options
context:
space:
mode:
authorIgor Minar2012-01-05 23:03:45 -0800
committerIgor Minar2012-01-06 12:19:39 -0800
commitcd9a7b9608707c34bec2316ee8c789a617d22a7b (patch)
tree407b7260e8159fe0c9aeaf301e067a7f9a5b1149 /src/apis.js
parent1dccaaaaa27a4db91d5271438688bc96e199e561 (diff)
downloadangular.js-cd9a7b9608707c34bec2316ee8c789a617d22a7b.tar.bz2
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
Diffstat (limited to 'src/apis.js')
-rw-r--r--src/apis.js10
1 files changed, 7 insertions, 3 deletions
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;
}