File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -1055,7 +1055,8 @@ function $ParseProvider() {
10551055 if ( oneTimeParseFn . $$unwatch && self && self . $$postDigestQueue ) {
10561056 self . $$postDigestQueue . push ( function ( ) {
10571057 // 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 ) ) {
10591060 lastValue = copy ( lastValue , null ) ;
10601061 }
10611062 } ) ;
Original file line number Diff line number Diff line change @@ -1012,8 +1012,18 @@ describe('parser', function() {
10121012
10131013 value . baz = 'baz' ;
10141014 expect ( fn ( ) ) . toEqual ( { bar : 'bar' } ) ;
1015+ } ) ) ;
10151016
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 ) ;
10161025 } ) ) ;
1026+
10171027 } ) ;
10181028
10191029
You can’t perform that action at this time.
0 commit comments