File tree 2 files changed +39
-2
lines changed
2 files changed +39
-2
lines changed Original file line number Diff line number Diff line change @@ -954,7 +954,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
954
954
955
955
if ( nodeLinkFn ) {
956
956
if ( nodeLinkFn . scope ) {
957
- childScope = scope . $new ( ) ;
957
+ childScope = scope . $new ( false , nodeLinkFn . partialDigest ) ;
958
958
$node . data ( '$scope' , childScope ) ;
959
959
} else {
960
960
childScope = scope ;
@@ -1368,6 +1368,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
1368
1368
}
1369
1369
1370
1370
nodeLinkFn . scope = newScopeDirective && newScopeDirective . scope === true ;
1371
+ nodeLinkFn . partialDigest = nodeLinkFn . scope && newScopeDirective . partialDigest ;
1371
1372
nodeLinkFn . transcludeOnThisElement = hasTranscludeDirective ;
1372
1373
nodeLinkFn . templateOnThisElement = hasTemplate ;
1373
1374
nodeLinkFn . transclude = childTranscludeFn ;
@@ -1448,7 +1449,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
1448
1449
var LOCAL_REGEXP = / ^ \s * ( [ @ = & ] ) ( \? ? ) \s * ( \w * ) \s * $ / ;
1449
1450
var $linkNode = jqLite ( linkNode ) ;
1450
1451
1451
- isolateScope = scope . $new ( true ) ;
1452
+ isolateScope = scope . $new ( true , newIsolateScopeDirective . partialDigest ) ;
1452
1453
1453
1454
if ( templateDirective && ( templateDirective === newIsolateScopeDirective ||
1454
1455
templateDirective === newIsolateScopeDirective . $$originalDirective ) ) {
Original file line number Diff line number Diff line change @@ -2167,6 +2167,42 @@ describe('$compile', function() {
2167
2167
} ) ;
2168
2168
} ) ;
2169
2169
} ) ;
2170
+
2171
+ describe ( 'partialDigest' , function ( ) {
2172
+
2173
+ beforeEach ( module ( function ( ) {
2174
+ directive ( 'isolatePartialDigest' , valueFn ( {
2175
+ scope : { } ,
2176
+ partialDigest : true
2177
+ } ) ) ;
2178
+ directive ( 'newPartialDigest' , valueFn ( {
2179
+ scope : true ,
2180
+ partialDigest : true
2181
+ } ) ) ;
2182
+ } ) ) ;
2183
+
2184
+
2185
+ it ( 'should allow you to mark an isolated scope with partialDigest' , inject (
2186
+ function ( $rootScope , $compile ) {
2187
+ spyOn ( $rootScope , '$new' ) . andCallThrough ( ) ;
2188
+
2189
+ expect ( $rootScope . $new ) . not . toHaveBeenCalled ( ) ;
2190
+
2191
+ element = $compile ( '<div isolate-partial-digest></div>' ) ( $rootScope ) ;
2192
+ expect ( $rootScope . $new ) . toHaveBeenCalledWith ( true , true ) ;
2193
+ } ) ) ;
2194
+
2195
+
2196
+ it ( 'should allow you to mark a new scope with partialDigest' , inject (
2197
+ function ( $rootScope , $compile ) {
2198
+ spyOn ( $rootScope , '$new' ) . andCallThrough ( ) ;
2199
+
2200
+ expect ( $rootScope . $new ) . not . toHaveBeenCalled ( ) ;
2201
+
2202
+ element = $compile ( '<div new-partial-digest></div>' ) ( $rootScope ) ;
2203
+ expect ( $rootScope . $new ) . toHaveBeenCalledWith ( false , true ) ;
2204
+ } ) ) ;
2205
+ } ) ;
2170
2206
} ) ;
2171
2207
2172
2208
You can’t perform that action at this time.
0 commit comments