aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng/directive/ngRepeat.js
diff options
context:
space:
mode:
authorIgor Minar2012-08-31 13:41:10 -0700
committerIgor Minar2012-08-31 13:59:03 -0700
commit5e9041818bca770c9261a3963e05dbb3c7ca2f06 (patch)
tree9ca0b713d32ecb9d19a611759043b31f4270d18b /src/ng/directive/ngRepeat.js
parentdb861db1f239bdb2c13f157e2632cb2bc76f0432 (diff)
downloadangular.js-5e9041818bca770c9261a3963e05dbb3c7ca2f06.tar.bz2
revert: fix(ng-repeat) to work with primitive types
this was accidentaly merged in. the commit is not ready yet and we don't have CLA signature. This reverts commit 98d489712eff7559bce87ae53bd242112a875c1a.
Diffstat (limited to 'src/ng/directive/ngRepeat.js')
-rw-r--r--src/ng/directive/ngRepeat.js28
1 files changed, 1 insertions, 27 deletions
diff --git a/src/ng/directive/ngRepeat.js b/src/ng/directive/ngRepeat.js
index a47b7abc..6dd74ef5 100644
--- a/src/ng/directive/ngRepeat.js
+++ b/src/ng/directive/ngRepeat.js
@@ -88,7 +88,6 @@ var ngRepeatDirective = ngDirective({
// We need an array of these objects since the same object can be returned from the iterator.
// We expect this to be a rare case.
var lastOrder = new HashQueueMap();
- var indexValues = [];
scope.$watch(function(scope){
var index, length,
collection = scope.$eval(rhs),
@@ -118,20 +117,7 @@ var ngRepeatDirective = ngDirective({
for (index = 0, length = array.length; index < length; index++) {
key = (collection === array) ? index : array[index];
value = collection[key];
-
- // if collection is array and value is object, it can be shifted to allow for position change
- // if collection is array and value is not object, need to first check whether index is same to
- // avoid shifting wrong value
- // if collection is not array, need to always check index to avoid shifting wrong value
- if (lastOrder.peek(value)) {
- last = collection === array ?
- ((isObject(value)) ? lastOrder.shift(value) :
- (index === lastOrder.peek(value).index ? lastOrder.shift(value) : undefined)) :
- (index === lastOrder.peek(value).index ? lastOrder.shift(value) : undefined);
- } else {
- last = undefined;
- }
-
+ last = lastOrder.shift(value);
if (last) {
// if we have already seen this object, then we need to reuse the
// associated scope/element
@@ -151,12 +137,6 @@ var ngRepeatDirective = ngDirective({
cursor = last.element;
}
} else {
- if (indexValues.hasOwnProperty(index) && collection !== array) {
- var preValue = indexValues[index];
- var v = lastOrder.shift(preValue);
- v.element.remove();
- v.scope.$destroy();
- }
// new item which we don't know about
childScope = scope.$new();
}
@@ -178,16 +158,10 @@ var ngRepeatDirective = ngDirective({
index: index
};
nextOrder.push(value, last);
- indexValues[index] = value;
});
}
}
- var i, l;
- for (i = 0, l = indexValues.length - length; i < l; i++) {
- indexValues.pop();
- }
-
//shrink children
for (key in lastOrder) {
if (lastOrder.hasOwnProperty(key)) {