@@ -2335,7 +2335,10 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
23352335
23362336
23372337 function addAttrInterpolateDirective ( node , directives , value , name , allOrNothing ) {
2338- var interpolateFn = $interpolate ( value , true ) ;
2338+ var trustedContext = getTrustedContext ( node , name ) ;
2339+ allOrNothing = ALL_OR_NOTHING_ATTRS [ name ] || allOrNothing ;
2340+
2341+ var interpolateFn = $interpolate ( value , true , trustedContext , allOrNothing ) ;
23392342
23402343 // no interpolation found -> ignore
23412344 if ( ! interpolateFn ) return ;
@@ -2360,16 +2363,16 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
23602363 "ng- versions (such as ng-click instead of onclick) instead." ) ;
23612364 }
23622365
2363- // If the attribute was removed, then we are done
2364- if ( ! attr [ name ] ) {
2365- return ;
2366+ // If the attribute has changed since last $interpolate()ed
2367+ var newValue = attr [ name ] ;
2368+ if ( newValue !== value ) {
2369+ // we need to interpolate again since the attribute value has been updated
2370+ // (e.g. by another directive's compile function)
2371+ // ensure unset/empty values make interpolateFn falsy
2372+ interpolateFn = newValue && $interpolate ( newValue , true , trustedContext , allOrNothing ) ;
2373+ value = newValue ;
23662374 }
23672375
2368- // we need to interpolate again, in case the attribute value has been updated
2369- // (e.g. by another directive's compile function)
2370- interpolateFn = $interpolate ( attr [ name ] , true , getTrustedContext ( node , name ) ,
2371- ALL_OR_NOTHING_ATTRS [ name ] || allOrNothing ) ;
2372-
23732376 // if attribute was updated so that there is no interpolation going on we don't want to
23742377 // register any observers
23752378 if ( ! interpolateFn ) return ;
0 commit comments