Angularjs instruction code, do not understand, ask the superior to explain?

  node.js, question
angular.module('cnodejs.directives').directive(
 // Collection-repeat image recycling while loading
 //  https://github.com/driftyco/ionic/issues/1742
 'resetImg', function ($document) {
 return {
 restrict: 'A',
 link: function($scope, $element, $attributes) {
 var applyNewSrc = function (src) {
 var newImg = $element.clone(true);
 
 newImg.attr('src', src);
 $element.replaceWith(newImg);
 $element = newImg;
 };
 
 $attributes.$observe('src', applyNewSrc);
 $attributes.$observe('ngSrc', applyNewSrc);
 bracket
 };
 bracket
 );
  1. A matchreset-imgThe instruction of the attribute

  2. The that monitors the action element of the instructionsrcAndng-srcChanges in attributes

  3. srcAndng-srcWhen the attribute changes, the of the element in which it is located is updatedsrcThe property is the changed value