code: function collectionRepeatSrcDirective(ngAttrName, attrName) {
    return [function() {
      return {
        priority: '99', // it needs to run after the attributes are interpolated
        link: function(scope, element, attr) {
          attr.$observe(ngAttrName, function(value) {
            if (!value) {
              element[0].removeAttribute(attrName);
            }
          });
        }
      };
    }];
  }
docs: Fix for #1674 Problem: if an ngSrc or ngHref expression evaluates to a falsy value, it will not erase the previous truthy value of the href. In collectionRepeat, we re-use elements from before. So if the ngHref expression evaluates to truthy for item 1 and then falsy for item 2, if an element changes from representing item 1 to representing item 2, item 2 will still have item 1's href value. Solution:  erase the href or src attribute if ngHref/ngSrc are falsy.