This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +12
-1
lines changed
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -1055,7 +1055,8 @@ function $ParseProvider() {
1055
1055
if ( oneTimeParseFn . $$unwatch && self && self . $$postDigestQueue ) {
1056
1056
self . $$postDigestQueue . push ( function ( ) {
1057
1057
// create a copy if the value is defined and it is not a $sce value
1058
- if ( ( stable = isDefined ( lastValue ) ) && ! lastValue . $$unwrapTrustedValue ) {
1058
+ if ( ( stable = isDefined ( lastValue ) ) &&
1059
+ ( lastValue === null || ! lastValue . $$unwrapTrustedValue ) ) {
1059
1060
lastValue = copy ( lastValue , null ) ;
1060
1061
}
1061
1062
} ) ;
Original file line number Diff line number Diff line change @@ -1012,8 +1012,18 @@ describe('parser', function() {
1012
1012
1013
1013
value . baz = 'baz' ;
1014
1014
expect ( fn ( ) ) . toEqual ( { bar : 'bar' } ) ;
1015
+ } ) ) ;
1015
1016
1017
+ it ( 'should not throw if the stable value is `null`' , inject ( function ( $parse , $rootScope ) {
1018
+ var fn = $parse ( '::foo' ) ;
1019
+ $rootScope . $watch ( fn ) ;
1020
+ $rootScope . foo = null ;
1021
+ $rootScope . $digest ( ) ;
1022
+ $rootScope . foo = 'foo' ;
1023
+ $rootScope . $digest ( ) ;
1024
+ expect ( fn ( ) ) . toEqual ( null ) ;
1016
1025
} ) ) ;
1026
+
1017
1027
} ) ;
1018
1028
1019
1029
You can’t perform that action at this time.
0 commit comments