A
A
Artur Aralin2014-10-07 13:59:24
Angular
Artur Aralin, 2014-10-07 13:59:24

AngularJS. Is it good to use $timeout?

Hello! It's not uncommon to have to use $timeout is it good or not and if not what alternative is there?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2014-10-07
@ArturAralin

In order that it would not be necessary to do a phase check ($apply, $digest) of the norms. Otherwise, it depends on the case.
If you are waiting for something in this way, then you should think in the direction of promises.
If you need to wait for reflow / paint or something like that - most likely the norms, although it might be possible to get by with the usual setTimeout without calling $digest.
Some still create promises through $timeout so that $apply is not manually pulled and $q is not injected.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question