图像前的背景载荷 - 角度js

时间:2017-03-06 09:51:11

标签: css angularjs

嗨,当我加载页面时,我看到"图像类"的背景​​。在ng-src图像加载之前加载

有没有办法解决这个问题?

使用Angular js

    <div class="images" >
         <img ng-if="expression" class="imgclass" ng-src="{{vm.src  ||  '//:0' }}" /> 
             <img ng-if="!expression" class="imgclass" ng-src="absolute url" /> 
     </div>

1 个答案:

答案 0 :(得分:0)

我会试试这个:

<div class="images" ng-if="loaded===true" >
  <img ng-if="expression" class="imgclass" ng-src="{{vm.src  ||  '//:0' }}" ng-init="loaded = true"/> 
  <img ng-if="!expression" class="imgclass" ng-src="absolute url" ng-init="loaded = true"/> 
</div>