如何将 Angular ng-src 的输出从 'src' 属性更改为 'data-src'?
How do I change the output of Angular ng-src from the 'src' attribute to 'data-src'?
我正在使用 jquery 插件 OwlCarousel,在我的一个视图中使用 ng-repeat 场景,如下所示:
<div owl-carousel-item="" ng-repeat="item in items" class="item">
<img id="image{{ $index }}" data-ng-src="http://uploads.mysite.com/{{ article.photoURL }}" class="lazyOwl" />
</div>
它运行良好并为轮播中的每个项目输出以下标记:
<img id="image0" data-ng-src="http://uploads.mysite.co/rs/e1f7daf77d42537212d31d8dbd113ec8.jpg" class="lazyOwl" src="http://uploads.mysite.co/rs/e1f7daf77d42537212d31d8dbd113ec8.jpg">
有没有办法让输出呈现“data-src=...
”而不仅仅是“src=...
”?
改用ng-attr
。 ng-src
只是特例
我正在使用 jquery 插件 OwlCarousel,在我的一个视图中使用 ng-repeat 场景,如下所示:
<div owl-carousel-item="" ng-repeat="item in items" class="item">
<img id="image{{ $index }}" data-ng-src="http://uploads.mysite.com/{{ article.photoURL }}" class="lazyOwl" />
</div>
它运行良好并为轮播中的每个项目输出以下标记:
<img id="image0" data-ng-src="http://uploads.mysite.co/rs/e1f7daf77d42537212d31d8dbd113ec8.jpg" class="lazyOwl" src="http://uploads.mysite.co/rs/e1f7daf77d42537212d31d8dbd113ec8.jpg">
有没有办法让输出呈现“data-src=...
”而不仅仅是“src=...
”?
改用ng-attr
。 ng-src
只是特例