From 1da0e0c8352a4309ec6437987a6b2a309aeae66e Mon Sep 17 00:00:00 2001 From: mohamed amr Date: Wed, 18 Nov 2015 12:34:53 +0200 Subject: [PATCH 1/2] fix(ngOptionsDirective): fix form pristine (use !equals function instead of !== for issue 13211) --- src/ng/directive/ngOptions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ng/directive/ngOptions.js b/src/ng/directive/ngOptions.js index 8032253573e9..58a607683399 100644 --- a/src/ng/directive/ngOptions.js +++ b/src/ng/directive/ngOptions.js @@ -733,7 +733,7 @@ var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) { // Check to see if the value has changed due to the update to the options if (!ngModelCtrl.$isEmpty(previousValue)) { var nextValue = selectCtrl.readValue(); - if (ngOptions.trackBy ? !equals(previousValue, nextValue) : previousValue !== nextValue) { + if (!equals(previousValue, nextValue)) { ngModelCtrl.$setViewValue(nextValue); ngModelCtrl.$render(); } From 4613a730a8f6dc3ef70a7d1a6f09e571d592e5a1 Mon Sep 17 00:00:00 2001 From: mohamed amr Date: Thu, 19 Nov 2015 19:42:47 +0200 Subject: [PATCH 2/2] fix(ngOptionsDirective): use equals function if attr.multiple(to save performance issues) --- src/ng/directive/ngOptions.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ng/directive/ngOptions.js b/src/ng/directive/ngOptions.js index 58a607683399..7f1e13ec32f4 100644 --- a/src/ng/directive/ngOptions.js +++ b/src/ng/directive/ngOptions.js @@ -733,7 +733,8 @@ var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) { // Check to see if the value has changed due to the update to the options if (!ngModelCtrl.$isEmpty(previousValue)) { var nextValue = selectCtrl.readValue(); - if (!equals(previousValue, nextValue)) { + var isNotPrimitive = ngOptions.trackBy || multiple; + if (isNotPrimitive ? !equals(previousValue, nextValue) : previousValue !== nextValue) { ngModelCtrl.$setViewValue(nextValue); ngModelCtrl.$render(); }