This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +43
-1
lines changed
2 files changed +43
-1
lines changed Original file line number Diff line number Diff line change @@ -162,7 +162,6 @@ var ngTranscludeMinErr = minErr('ngTransclude');
162
162
var ngTranscludeDirective = [ '$compile' , function ( $compile ) {
163
163
return {
164
164
restrict : 'EAC' ,
165
- terminal : true ,
166
165
compile : function ngTranscludeCompile ( tElement ) {
167
166
168
167
// Remove and cache any original content to act as a fallback
Original file line number Diff line number Diff line change @@ -8582,6 +8582,49 @@ describe('$compile', function() {
8582
8582
} ) ;
8583
8583
8584
8584
8585
+ it ( 'should compile directives with lower priority than ngTransclude' , function ( ) {
8586
+ var ngTranscludePriority ;
8587
+ var lowerPriority = - 1 ;
8588
+
8589
+ module ( function ( $provide ) {
8590
+ $provide . decorator ( 'ngTranscludeDirective' , function ( $delegate ) {
8591
+ ngTranscludePriority = $delegate [ 0 ] . priority ;
8592
+ return $delegate ;
8593
+ } ) ;
8594
+
8595
+ directive ( 'lower' , function ( log ) {
8596
+ return {
8597
+ priority : lowerPriority ,
8598
+ link : {
8599
+ pre : function ( ) {
8600
+ log ( 'pre' ) ;
8601
+ } ,
8602
+ post : function ( ) {
8603
+ log ( 'post' ) ;
8604
+ }
8605
+ }
8606
+ } ;
8607
+ } ) ;
8608
+ directive ( 'trans' , function ( log ) {
8609
+ return {
8610
+ transclude : true ,
8611
+ template : '<div lower ng-transclude></div>'
8612
+ } ;
8613
+ } ) ;
8614
+ } ) ;
8615
+ inject ( function ( log , $rootScope , $compile ) {
8616
+ element = $compile ( '<div trans><span>transcluded content</span></div>' ) ( $rootScope ) ;
8617
+
8618
+ expect ( lowerPriority ) . toBeLessThan ( ngTranscludePriority ) ;
8619
+
8620
+ $rootScope . $apply ( ) ;
8621
+
8622
+ expect ( element . text ( ) ) . toEqual ( 'transcluded content' ) ;
8623
+ expect ( log ) . toEqual ( 'pre; post' ) ;
8624
+ } ) ;
8625
+ } ) ;
8626
+
8627
+
8585
8628
it ( 'should not merge text elements from transcluded content' , function ( ) {
8586
8629
module ( function ( ) {
8587
8630
directive ( 'foo' , valueFn ( {
You can’t perform that action at this time.
0 commit comments