aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMisko Hevery2010-07-23 13:36:08 -0700
committerMisko Hevery2010-07-23 13:36:08 -0700
commit3b41979891f5dc6a68e05cd5ed9c355c34774193 (patch)
treed88782f1be778c5546d686a37f809fe86ce20ae8
parent2ac66b78f0d2068166c617e6e82d038ac4d46f0a (diff)
downloadangular.js-3b41979891f5dc6a68e05cd5ed9c355c34774193.tar.bz2
fix bug which only showed up in ie7
-rw-r--r--src/directives.js39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/directives.js b/src/directives.js
index 32b012f3..ffe37890 100644
--- a/src/directives.js
+++ b/src/directives.js
@@ -166,26 +166,27 @@ angularWidget("@ng:repeat", function(expression, element){
var index = 0, childCount = children.length, childScope, lastElement = reference,
collection = this.$tryEval(rhs, reference), is_array = isArray(collection);
for ( var key in collection) {
- if (is_array && !collection.hasOwnProperty(key)) break;
- if (index < childCount) {
- // reuse existing child
- childScope = children[index];
- childScope[valueIdent] = collection[key];
- if (keyIdent) childScope[keyIdent] = key;
- } else {
- // grow children
- childScope = template(element.clone(), createScope(currentScope));
- childScope[valueIdent] = collection[key];
- if (keyIdent) childScope[keyIdent] = key;
- lastElement.after(childScope.$element);
- childScope.$index = index;
- childScope.$element.attr('ng:repeat-index', index);
- childScope.$init();
- children.push(childScope);
+ if (!is_array || collection.hasOwnProperty(key)) {
+ if (index < childCount) {
+ // reuse existing child
+ childScope = children[index];
+ childScope[valueIdent] = collection[key];
+ if (keyIdent) childScope[keyIdent] = key;
+ } else {
+ // grow children
+ childScope = template(element.clone(), createScope(currentScope));
+ childScope[valueIdent] = collection[key];
+ if (keyIdent) childScope[keyIdent] = key;
+ lastElement.after(childScope.$element);
+ childScope.$index = index;
+ childScope.$element.attr('ng:repeat-index', index);
+ childScope.$init();
+ children.push(childScope);
+ }
+ childScope.$eval();
+ lastElement = childScope.$element;
+ index ++;
}
- childScope.$eval();
- lastElement = childScope.$element;
- index ++;
};
// shrink children
while(children.length > index) {