In this video Iftach Bar explains how to use the built- in $watch function to watch over a whole object instead of just a simple value.
- [Instructor] Another important feature…I want to talk about is called the deep watch.…Up until now, we looked at the watch expression…that returns a simple value, a string, or a number.…But what will happen if we try to watch a full object?…Let's have a look.…I'll create a new object under vm called userProperties.…And this object will hold some properties…that the user have.…For example, favorite color, nickname, and force.…
I'll update the usages of force to use userProperties.force.…I'll go and update the index.html as well.…I'll get rid of the bindme div we used previously.…I'll also get rid of this scope expression…to use a deep watch and see how it works.…
I am going to watch the whole vm.userProperties object.…In the listener, I'm going to print to the console…whenever the user properties has changed.…Let's go to the app and see what happens.…First we can see that whenever we change the force variable,…it still changes as we would have expected.…But notice that besides that one line,…one first line here, that's printed, the user properties,…
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.