为了账号安全,请及时绑定邮箱和手机立即绑定

angularjs指令的代码,看不懂,求高手解释下?

angularjs指令的代码,看不懂,求高手解释下?

摇曳的蔷薇 2018-08-17 09:10:49
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);      }    };  });
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 508 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信