In this video Iftach Bar demonstrates a full digest loop by going over it step by step to fully explain how digest operates.
- [Instructor] When I first started…to understand the digest loop, I asked myself,…why is it a loop that runs several times?…Why not just go over all the watched expressions once,…see if they have changed, run their listeners, and stop?…The answer is quite simple.…Some watchers might change other values in their listeners.…Although it shouldn't happen a lot,…it might happen a few times.…This is the depth of your watched dependency…and you'd like to keep it as shallow as you can.…
To show you how it works in the code,…I'm going to add another variable…which I'm going to call force in US dollars.…I decided that every unit of force equals 10 US dollars.…So let's calculate forceIn US dollars…equals vm.force times 10.…Since you want to keep the force in US dollars…synced with the value of force,…I'm going to add another watcher here…in the end of the file on line 20…and I'm going to say watch over vm.force…and whenever force changes…I'm going to update the forceIn US dollars…to be force times 10.…
I'm going to go to the index html file as well.…
This advanced AngularJS course helps you explore the connected worlds of $scope and the digest cycle. Instructor Iftach Bar explains scope and inheritance, goes behind the scenes of the digest loop, and teaches both manual and automatic data binding approaches. Plus, learn how to integrate external libraries, diagnose performance issues, and debug your applications.
- $scope and controllers
- $scope built-in variables and methods
- $scope prototype inheritance
- Manual data binding with $scope.$watch
- The digest loop
- Get the $scope in the console
- Forcing $digest
Skill Level Advanced
AngularJS 1: Building a Data-Driven Appwith Ray Villalobos2h 15m Intermediate
1. Scope Basics
2. Manual Data Bindings
3. The Digest Loop
4. Tips for Debugging Angular in the Console
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.