This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 1 file changed +15
-7
lines changed
1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -880,26 +880,34 @@ NgModelController.prototype = {
880
880
this . $options = this . $options . createChild ( options ) ;
881
881
} ,
882
882
883
- $setModelValue : function ( modelValue ) {
884
- this . $modelValue = this . $$rawModelValue = modelValue ;
885
- this . $$parserValid = undefined ;
886
-
883
+ $format : function ( ) {
887
884
var formatters = this . $formatters ,
888
885
idx = formatters . length ;
889
886
890
- var viewValue = modelValue ;
887
+ var viewValue = this . $ modelValue;
891
888
while ( idx -- ) {
892
889
viewValue = formatters [ idx ] ( viewValue ) ;
893
890
}
891
+
894
892
if ( this . $viewValue !== viewValue ) {
895
893
this . $$updateEmptyClasses ( viewValue ) ;
896
- this . $viewValue = this . $$ lastCommittedViewValue = viewValue ;
897
- this . $render ( ) ;
894
+ this . $viewValue = this . $lastCommittedViewValue = viewValue ;
895
+ }
898
896
897
+ return viewValue ;
898
+ } ,
899
+
900
+ $setModelValue : function ( modelValue ) {
901
+ this . $modelValue = this . $$rawModelValue = modelValue ;
902
+ this . $$parserValid = undefined ;
903
+
904
+ if ( this . $viewValue !== this . $format ( ) ) {
905
+ this . $render ( ) ;
899
906
// It is possible that model and view value have been updated during render
900
907
this . $$runValidators ( this . $modelValue , this . $viewValue , noop ) ;
901
908
}
902
909
}
910
+
903
911
} ;
904
912
905
913
function setupModelWatcher ( ctrl ) {
You can’t perform that action at this time.
0 commit comments