Why is there no $interval in AngularJS? -


angularjs has $timeout service acts convenience wrapper around settimeout.

why there no equivalent setinterval?

since $timeout calls scope.apply after each call can expensive. creating simple interval can decide watches , apply calls needed keep clean.

for example, if interval running once every minute check if user's values had changed , optionally saving if values had been changed since last check. depending on how write code, may never need update web page, interval can without triggering update.

that doesn't answer question directly of why $interval isn't provided default, suspect because since simple create own specific requirements, better leave open enhance, instead of providing default implementation complex, or inflexible.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -