@@ -1153,7 +1153,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
1153
1153
maxPriority , ignoreDirective , previousCompileContext ) ;
1154
1154
compile . $$addScopeClass ( $compileNodes ) ;
1155
1155
var namespace = null ;
1156
- return function publicLinkFn ( scope , cloneConnectFn , transcludeControllers , parentBoundTranscludeFn , futureParentElement ) {
1156
+ return function publicLinkFn ( scope , cloneConnectFn , futureParentElement , transcludeControllers , parentBoundTranscludeFn ) {
1157
1157
assertArg ( scope , 'scope' ) ;
1158
1158
if ( ! namespace ) {
1159
1159
namespace = detectNamespaceForChildElements ( futureParentElement ) ;
@@ -1317,14 +1317,14 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
1317
1317
1318
1318
function createBoundTranscludeFn ( scope , transcludeFn , previousBoundTranscludeFn , elementTransclusion ) {
1319
1319
1320
- var boundTranscludeFn = function ( transcludedScope , cloneFn , controllers , futureParentElement , containingScope ) {
1320
+ var boundTranscludeFn = function ( transcludedScope , cloneFn , futureParentElement , controllers , containingScope ) {
1321
1321
1322
- if ( ! transcludedScope ) {
1322
+ if ( ! transcludedScope && ! transcludeFn . $$bound ) {
1323
1323
transcludedScope = scope . $new ( false , containingScope ) ;
1324
1324
transcludedScope . $$transcluded = true ;
1325
1325
}
1326
1326
1327
- return transcludeFn ( transcludedScope , cloneFn , controllers , previousBoundTranscludeFn , futureParentElement ) ;
1327
+ return transcludeFn ( transcludedScope , cloneFn , futureParentElement , controllers , previousBoundTranscludeFn ) ;
1328
1328
} ;
1329
1329
1330
1330
return boundTranscludeFn ;
@@ -1793,7 +1793,10 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
1793
1793
isolateScope = scope . $new ( true ) ;
1794
1794
}
1795
1795
1796
- transcludeFn = boundTranscludeFn && controllersBoundTransclude ;
1796
+ if ( boundTranscludeFn ) {
1797
+ transcludeFn = controllersBoundTransclude ;
1798
+ transcludeFn . $$bound = true ;
1799
+ }
1797
1800
if ( controllerDirectives ) {
1798
1801
// TODO: merge `controllers` and `elementControllers` into single object.
1799
1802
controllers = { } ;
@@ -1953,7 +1956,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
1953
1956
var transcludeControllers ;
1954
1957
1955
1958
// No scope passed in:
1956
- if ( ! isScope ( scope ) ) {
1959
+ if ( ! isScope ( scope ) && ! isUndefined ( scope ) ) {
1957
1960
futureParentElement = cloneAttachFn ;
1958
1961
cloneAttachFn = scope ;
1959
1962
scope = undefined ;
@@ -1965,7 +1968,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
1965
1968
if ( ! futureParentElement ) {
1966
1969
futureParentElement = hasElementTranscludeDirective ? $element . parent ( ) : $element ;
1967
1970
}
1968
- return boundTranscludeFn ( scope , cloneAttachFn , transcludeControllers , futureParentElement , scopeToChild ) ;
1971
+ return boundTranscludeFn ( scope , cloneAttachFn , futureParentElement , transcludeControllers , scopeToChild ) ;
1969
1972
}
1970
1973
}
1971
1974
}
0 commit comments