title: angular js '?' in ng-src causes infinite loop
body: <p>I am trying to get a way around IE getting images from cache while using AngularJS</p>
  
  <p>I have this following code</p>
  
  <pre><code>&lt;img ng-src="./individuals/image/{{team._id}}/{{member._id}}{{getRandom()}}" &gt;
  </code></pre>
  
  <p>In the controller </p>
  
  <pre><code>$scope.getRandom=function(){
          return "?ran="+new Date().getTime()+"";
  }
  </code></pre>
  
  <p>When I run, I get this error</p>
  
  <pre><code>Error: 10 $digest() iterations reached. Aborting! Watchers fired in the last 5 iterations: [["fn: function (a){\n\"use strict\";\ntry{for(var b=0,c=q,g;b&lt;c;b++){if(typeof(g=l[b])==\"function\")g=g(a),g==null||g==s?g=\"\":typeof g!=\"string\"&amp;&amp;(g=da(g));B[b]=g}return B.join(\"\")}catch(f){d(Error(\"Error while interpolating: \"+e+\"\\n\"+f.toString()))}}; newVal: \"./individuals/image/51c209ead8b8d863ad69de97/51c209ead8b8d863ad69de65?ran=1371757784485\"; oldVal: \"./individuals/image/51c209ead8b8d863ad69de97/51c209ead8b8d863ad69de65?ran=1371757784457\"","fn: function (a){\n\"use strict\";\ntry{for(var b=0,c=q,g;b&lt;c;b++){if(typeof(g=l[b])==\"function\")g=g(a),g==null||g==s?g=\"\":typeof g!=\"string\"&amp;&amp;(g=da(g));B[b]=g}return B.join(\"\")}catch(f){d(Error(\"Error while interpolating: \"+e+\"\\n\"+f.toString()))}}; newVal: \"./individuals/image/51c209ead8b8d863ad69de97/51c209ead8b8d863ad69dec9?ran=1371757784487\"; oldVal: \"./individuals/image/51c209ead8b8d863ad69de97/51c209ead8b8d863ad69dec9?ran=1371757784459\"","fn: function (a){\n\"use strict\";\ntry{for(var b=0,c=q,g;b&lt;c;b++){if(typeof(g=l[b])==\"function\")g=g(a),g==null||g==s?g=\"\":typeof g!=\"string\"&amp;&amp;(g=da(g));B[b]=g}return B.join(\"\")}catch(f){d(Error(\"Error while interpolating: \"+e+\"\\n\"+f.toString()))}}; newVal: \"./individuals/image/51c209ead8b8d863ad6
  </code></pre>
  
  <p>If I remove the <code>{{getRandom()}}</code> it works fine.</p>
  
  <p>Please help.. Thanks in advance</p>
  
  <p><em><strong>UPDATE: Please find below the changes to controller that fixed the issue. Thanks to the answer from Liviu T.</em></strong></p>
  
  <pre><code>$scope.lastMillis = new Date().getTime();
      $scope.getRandom=function(){
          var curMillis = new Date().getTime();
          if (curMillis-$scope.lastMillis&gt;5000) {
              $scope.lastMillis = curMillis;
          }
          return "?ran="+$scope.lastMillis;
      }
  </code></pre>