Answer the question
In order to leave comments, you need to log in
Simultaneous access to javascript variable?
Hello. I am using angular.js. I have this situation:
- there are several directives on the page that generate some content
- directives in the view go in a certain order
- after loading the directive, or rather executing the link method, I increase the variable in the parent scope (that is, in the scope of the controller) by 1, in fact, I keep a counter of loaded directives.
Is it possible that two directives can change the value of this variable at the same time? And one increase is lost. Does javascript have some sort of mutex type locking mechanism for accessing a variable?
Angular has just started learning, so maybe the question is not quite correct and not in full accordance with angular terminology
Thanks for the answers
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question