# AngularJS - controllers
# communication between controllers
ways to communicate between controllers (services + events)
# controllerAs
syntax
digging-into-angulars-controller-as-syntax
Le principe c'est de ne plus injecter le scope pour travailler dessus mais d'utiliser le controller pour l'interpolation.
En terme d'achi, le controller n'est plus vraiment un controlleur mais prend sa place dans le MVVM en tant que V (associé au HTML)
# $scope
# $scope
must read
- docs.angularjs.org scope
$rootScope.Scope
- better doc then thie official one
- the-three-watch-depths-of-angularjs
- angularjs-watch-digest-and-apply
- databinding-in-angularjs with MiskoH comments
- nuances-of-scope-prototypal-prototypical-inheritance-in-angularjs
- Comprendre le data binding dans Angular, React et Vue : Sylvain Pollet-Villard : 20160322
# $digest
already in progress issue
# EvalAsync()
or setTimeOut()
- scope-evalasync-vs-timeout-in-angularjs
- EvalSync is to put your thing in the angular loop
- TimeOut is to delay your thing outside and probably after the angular loop
- angularjs-evalasync-vs-timeout
- if code is queued using
$evalAsync
from a directive, it should run after the DOM has been manipulated by Angular, but before the browser renders - if code is queued using
$evalAsync
from a controller, it should run before the DOM has been manipulated by Angular (and before the browser renders) -- rarely do you want this - if code is queued using
$timeout
, it should run after the DOM has been manipulated by Angular, and after the browser renders (which may cause flicker in some cases)
# $scope
dirty checking
- the-three-watch-depths-of-angularjs
- Angular is doing references comparisons when checking model changes.
- All binding done with bracers,
ng-model
etc ... set a reference check. - dont bind to primitives