@@ -1809,23 +1809,31 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
1809
1809
}
1810
1810
1811
1811
1812
- function addTextInterpolateDirective ( directives , text ) {
1813
- var interpolateFn = $interpolate ( text , true ) ;
1814
- if ( interpolateFn ) {
1815
- directives . push ( {
1816
- priority : 0 ,
1817
- compile : valueFn ( function textInterpolateLinkFn ( scope , node ) {
1818
- var parent = node . parent ( ) ,
1819
- bindings = parent . data ( '$binding' ) || [ ] ;
1820
- bindings . push ( interpolateFn ) ;
1821
- safeAddClass ( parent . data ( '$binding' , bindings ) , 'ng-binding' ) ;
1822
- scope . $watch ( interpolateFn , function interpolateFnWatchAction ( value ) {
1823
- node [ 0 ] . nodeValue = value ;
1824
- } ) ;
1825
- } )
1826
- } ) ;
1812
+ function addTextInterpolateDirective ( directives , text ) {
1813
+ var interpolateFn = $interpolate ( text , true ) ;
1814
+ if ( interpolateFn ) {
1815
+ directives . push ( {
1816
+ priority : 0 ,
1817
+ compile : function textInterpolateCompileFn ( templateNode ) {
1818
+ // when transcluding a template that has bindings in the root
1819
+ // then we don't have a parent and should do this in the linkFn
1820
+ var parent = templateNode . parent ( ) , hasCompileParent = parent . length ;
1821
+ if ( hasCompileParent ) safeAddClass ( templateNode . parent ( ) , 'ng-binding' ) ;
1822
+
1823
+ return function textInterpolateLinkFn ( scope , node ) {
1824
+ var parent = node . parent ( ) ,
1825
+ bindings = parent . data ( '$binding' ) || [ ] ;
1826
+ bindings . push ( interpolateFn ) ;
1827
+ parent . data ( '$binding' , bindings ) ;
1828
+ if ( ! hasCompileParent ) safeAddClass ( parent , 'ng-binding' ) ;
1829
+ scope . $watch ( interpolateFn , function interpolateFnWatchAction ( value ) {
1830
+ node [ 0 ] . nodeValue = value ;
1831
+ } ) ;
1832
+ } ;
1833
+ }
1834
+ } ) ;
1835
+ }
1827
1836
}
1828
- }
1829
1837
1830
1838
1831
1839
function getTrustedContext ( node , attrNormalizedName ) {
0 commit comments