In this video Iftach Bar shows how to integrate code that runs outside the Angular context with Angular.
- [Instructor] In this chapter we'll see how we…can integrate external angular codes into angular.…Integration is pretty easy, all we need is…to call the digest loop manually…after we made the changes to the scope.…Well we already know how to do it,…just call the dollar apply method.…Back to the example where he had a button,…here on line 19 and in app.js,…we had a j-query click handler…that changed the variable dream on the vm.…
To force a digest all we'll need to do is to add the phrase…$scope.$apply in the end of our handler,…this will force a digest loop to happen,…which will update the dream in the dome as well.…Let's see that it works.…I'm going to click the bad button,…what I was saying before, when I clicked it,…nothing happened in the dome.…This time I'm going to click it and the dome changed.…To be a bit more precise, this is not the best way…to use dollar apply.…
Dollar apply actually accepts a function as an argument…and what dollar apply does is run the function he got,…and after the function is done, it initiates a digest loop.…
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.