@@ -2335,7 +2335,10 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
2335
2335
2336
2336
2337
2337
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 ) ;
2339
2342
2340
2343
// no interpolation found -> ignore
2341
2344
if ( ! interpolateFn ) return ;
@@ -2360,16 +2363,16 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
2360
2363
"ng- versions (such as ng-click instead of onclick) instead." ) ;
2361
2364
}
2362
2365
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 ;
2366
2374
}
2367
2375
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
-
2373
2376
// if attribute was updated so that there is no interpolation going on we don't want to
2374
2377
// register any observers
2375
2378
if ( ! interpolateFn ) return ;
0 commit comments