2

How to swap default image with loading.gif on ng-click and then display selected image when its loaded?

HTML -partial

    <img ng-src="currentImg"> <!-- this is the default image  -->
         <!-- i need to swap current image with loading.gif and then display selected img from below --> 
         <!-- on click is changing currentImg (default image) var to ng-src -->
   <img ng-click="currentImg=item.imgSmall1" ng-src="{{item.imgSmall1}}">
   <img ng-click="currentImg=item.imgSmall2" ng-src="{{item.imgSmall2}}">
        ...

JS -pseudo code

$scope.currentImg= "default img"; 
$scope.SETcurrentImg = function(...){
      currentImg="loading.gif";
      //when image is loaded display below img
      // ???
      currentImg="some selected img";
}
2
  • This shall help you out Commented Oct 8, 2015 at 5:52
  • 1
    @Ivan, Sorry, I didn't get you. What are you actually trying to do? Commented Oct 8, 2015 at 7:52

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.