Monday, 15 June 2015

angularjs - angular js '?' in ng-src causes infinite loop -


I am trying to get images from the cache while using an explorer JS

My This is the following code:

  & lt; Img ng-src = "./person / image / {{team._id}} / {{member._id}} {{getRandom ()}}" & gt;   

In the administrator

  $ scope.getRandom = function () {return "? Ran =" + new date () GetTime () + ""; }   

When I run, I get this error

  Error: 10 $ digest () iterated. Being aborted! Hidden viewers in the last 5 iterations: [[fn: function (a) {\ n \ "strict use \"; \ Ntry {for (var b = 0, c = q, g; b & lt; c; b ++) {g = (g = l [b] == \ "function \ string \" & amp; Amp; (g = da (g)); b [b] = g} return b. (\ "\") Hold (f) {d (error (\ "error interpolding: \" + e + \ "\\ n \?" + f.toString ()))}}; newVal: \ "./ persons / image / 51c209ead8b8d863ad69de97 / 51c209ead8b8d863ad69de65 ran = 1371757784485 \"; oldVal: \ "./ persons / image? / 51c209ead8b8d863ad69de97 / 51c209ead8b8d863ad69de65 ran = 1371757784457 \ "" "fn: function (a) {\ n \" strict access \ "; \ Check 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;; (g = da (g)); b [b] = g} return b. ("\")} (F) {d (error (\ "while interpolating error: \ "+ e + \" \\ n \ "+ f.toString ()))}}; newVal: \" ./ persons / image / 51c209ead8b8d863ad69de97 / 51c209ead8b8d863ad69dec9 ran = 1371757784487 \ "; oldVal: \" ./ Individuals / Image / 51c209ead8b8d863ad69de97 / 51c209ead8b8d863ad69dec9? Ran = 1371757784459 \ "," FN ": (Ifof (g = l [b]) = {function (a) {\ n \" use strict \ "; \ ntry {for (var b = 0, c = Q, g; b, & lt; c; b ++) = \ "function \") = G (a), g == faucet || g == s? G = \ "\": type g ! = \ "String \" and amp; and (g = da g); b [b] = g} return b ("\")} hold (f) {d (error (\ " error Intrpold: \ "+ e + \" \ \ n \ "+ F wire ()))}}; newVal :. \" ./ persons / image / 51c209ead8b8d863ad6   

If I remove {{getRandom ()}} this works fine

please help .. Thanks in advance

Update: Please find below the changes of the controller, fix the problem. Thanks for the reply from Liviu T.

  $ 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;}    

No comments:

Post a Comment