In this video Iftach Bar introduces the problem with the ng-repeat and ng-if directives and scope inheritance.
- [Instructor] The Controller As practice…we've seen previously,…solves other issues as well.…Not only between controllers that are defined…in our application.…There are some directives in Angular…that create a new scope when we use them.…For example, ng-repeat or ng-if.…I want to show you what will happen…if I'll use the ng-if directive within the code…without the Controller As syntax.…First, I'm going to remove a lot of code…from my index HTML file…in order to have only one controller,…only the Playground controller…without the internal controller at all.…
So first I'm going to go to row 17-21…and I'm going to remove this paragraph.…The next thing I'm going to do…is remove the as statement…to remove the Controller As syntax here.…I'm going to put the force variable…and the resetForce function…back on the scope.…I'll go over to the app.js file…and update the variables to be on the scope.…First I'll remove row four,…var vm equals this.…
I'm going to put the force variable on the scope,…and I'm going to change it also in line seven…
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.