In this video Iftach Bar talks about the two naming conventions for controllers and explains what method he thinks is better.
- [Lecturer] In the previous video,…we used the controller as syntax…to name our playground controller as playground.…Now, I want to use the same syntax…in order to name the internal controller…and continue the flow.…First, let's clean up the code a bit.…I'm going to delete this line…because it's not valuable to us anymore,…we know that secret has no meaning in playground controller.…And I'm going to name the internal controller as internal.…Now, when I do that,…I need to go to the app.js file…and I need to change the diving from scope to the vm.…
And the vm, in my case, again is this,…is the controller itself.…I'm going to bind the secret to vm…and I'm going to see that everything still works.…We have secret here,…we need to change it as well,…to be on internal.…Let's run it and see what happens.…The secret still works, everything else, of course,…works as expected.…Now that we have two controllers with different names,…we can see that when I'm trying to access a variable…from the internal controller,…I use the internal.secret.…
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.