Hi Larion,
You are right, javascript runs in a single thread. Personally I don’t think a setTimeout is a particularly good practice! Sometimes you just have to use it, but its often a source of confusion.
At the core of this is the AngularJS digest system. For some changes it takes a full digest cycle to propagate through your system. There are several different causes for this,
and without seeing your full code, I can’t give you one.
I think using $evalAsync is a better way to solve this.
try this in your code:
scope.$evalAsync('switched()');
note the quotes!
Basicly it does the same thing, but it comes with a guarantee (timeout does not!) that a digest cycle will occur after your function!
Regards
Sander
--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
To summarize: