From 9f89b2f0ec21061f954cfbf0ed44111b42e17209 Mon Sep 17 00:00:00 2001 From: Shahar Talmi Date: Sat, 4 Oct 2014 02:13:52 +0300 Subject: [PATCH] fix(select): manage select controller options correctly This fixes a regression that was introduced in 2bcd02d. Basically, the problem was that render() removed the wrong option from the select controller since it assumed that the option that was removed has the same label as the excessive option in existingOptions, but this is only correct if the option was popped from the end of the array. We now remember for each label whether it was added or removed (or removed at some point and then added at a different point) and report to the select controller only about options that were actually removed or added, ignoring any options that just moved. Closes #9418 --- src/ng/directive/select.js | 21 +++++++-- test/ng/directive/selectSpec.js | 84 +++++++++++++++++++++++++++------ 2 files changed, 88 insertions(+), 17 deletions(-) diff --git a/src/ng/directive/select.js b/src/ng/directive/select.js index fe17c903c522..d671cb1cbf45 100644 --- a/src/ng/directive/select.js +++ b/src/ng/directive/select.js @@ -203,7 +203,7 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) { // Workaround for https://code.google.com/p/chromium/issues/detail?id=381459 // Adding an