diff --git a/src/ng/directive/ngTransclude.js b/src/ng/directive/ngTransclude.js index ec31eaf5fc23..43d9e6b780b8 100644 --- a/src/ng/directive/ngTransclude.js +++ b/src/ng/directive/ngTransclude.js @@ -15,8 +15,8 @@ * * @element ANY * - * @param {string} ngTransclude|ngTranscludeSlot the name of the slot to insert at this point. If this is not provided or empty then - * the default slot is used. + * @param {string} ngTransclude|ngTranscludeSlot the name of the slot to insert at this point. If this is not provided, is empty + * or its value is the same as the name of the attribute then the default slot is used. * * @example * ### Default transclusion @@ -113,6 +113,12 @@ var ngTranscludeDirective = ngDirective({ restrict: 'EAC', link: function($scope, $element, $attrs, controller, $transclude) { + if ($attrs.ngTransclude === $attrs.$attr.ngTransclude) { + // If the attribute is of the form: `ng-transclude="ng-transclude"` + // then treat it like the default + $attrs.ngTransclude = ''; + } + function ngTranscludeCloneAttachFn(clone) { $element.empty(); $element.append(clone); diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index 83c5ada237ea..c353f5f9e3d4 100755 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -7680,6 +7680,40 @@ describe('$compile', function() { }); }); + it('should use the default transclusion slot if the ng-transclude attribute has the same value as its key', function() { + module(function() { + directive('minionComponent', function() { + return { + restrict: 'E', + scope: {}, + transclude: {}, + template: + '
' + + '' + + '' + }; + }); + }); + inject(function($rootScope, $compile) { + element = $compile( + '