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); } }; });
angularjs指令的代碼,看不懂,求高手解釋下?
搖曳的薔薇
2018-08-17 09:10:49