From 63c5334c84b7269428c710226764d1f08a36e0d4 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Thu, 10 Oct 2013 21:35:54 -0700 Subject: fix($compile): abort compilation when duplicate element transclusion Issue an error and abort compilation when two directives that ask for transclusion are found on a single element. This configuration is not supported and we previously failed to issue the error because in the case of element transclusion the compilation is re-started and this caused the compilation context to be lost. The ngRepeat directive has been special-cased to bypass this warning because it knows how to handle this scenario internally. This is not an ideal solution to the problem of multiple transclusions per element, we are hoping to have this configuration supported by the compiler in the future. See #4357. Closes #3893 Closes #4217 Closes #3307 --- test/ng/directive/ngRepeatSpec.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'test/ng/directive/ngRepeatSpec.js') diff --git a/test/ng/directive/ngRepeatSpec.js b/test/ng/directive/ngRepeatSpec.js index 8dba13bf..9dde36e7 100644 --- a/test/ng/directive/ngRepeatSpec.js +++ b/test/ng/directive/ngRepeatSpec.js @@ -976,6 +976,43 @@ describe('ngRepeat', function() { }); + describe('compatibility', function() { + + it('should allow mixing ngRepeat and another element transclusion directive', function() { + $compileProvider.directive('elmTrans', valueFn({ + transclude: 'element', + controller: function($transclude, $scope, $element) { + $transclude(function(transcludedNodes) { + $element.after(']]').after(transcludedNodes).after('[['); + }); + } + })); + + inject(function($compile, $rootScope) { + element = $compile('
some template;
'); + element = $compile('