In this video, You will learn "How to make a digital clock in HTML using AngularJS ?". Do watch the video and get benefitted !
$interval
service in module ng
Overview
AngularJS's wrapper for window.setInterval. The fn function is executed every delay milliseconds.
The return value of registering an interval function is a promise. This promise will be notified upon each tick of the interval, and will be resolved after count iterations, or run indefinitely if count is not defined. The value of the notification will be the number of iterations that have run. To cancel an interval, call $interval.cancel(promise).
In tests you can use $interval.flush(millis) to move forward by millis milliseconds and trigger any functions scheduled to run in that time.
Note: Intervals created by this service must be explicitly destroyed when you are finished with them. In particular they are not automatically destroyed when a controller's scope or a directive's element are destroyed. You should take this into consideration and make sure to always cancel the interval at the appropriate moment. See the example below for more details on how and when to do this.
Usage
$interval(fn, delay, [count], [invokeApply], [Pass]);
Arguments
Param Type Details
fn function()
A function that should be called repeatedly. If no additional arguments are passed (see below), the function is called with the current iteration count.
delay number
Number of milliseconds between each function call.
count(optional) number
Number of times to repeat. If not set, or 0, will repeat indefinitely.
(default: 0)
invokeApply(optional) boolean
If set to false skips model dirty checking, otherwise will invoke fn within the $apply block.
(default: true)
Pass(optional)*
additional parameters to the executed function.
Смотрите видео How to make a digital clock using Javascript (AngularJS)| AngularJS $interval | toLocaleTimeString() онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Engineers Revolution 11 Август 2020, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 493 раз и оно понравилось 9 людям.