FitzChivalry2 (23) [Avatar] Offline
I'm on page 61 of v06, and just realized that $scope.editing is just a plain ol' variable. The wording leading up to this point made me think that it was a property that had some kind of meaning. While you don't want to get wordy, some additional context for things in these early chapters might help readers to get up to speed faster.
jeremy.wilken (208) [Avatar] Offline
$scope is not quite just a plain ol' object. It is an object (as is almost everything in JavaScript) that Angular uses between the view and controller. It is also in a chain, so if you have a parent and child $scope, you can reach up and access the parent $scope values if they don't exist on the child.

It is fair to think of it as a standard object if you don't need it to do anything but share data between the controller and view, but that is not the entire picture of what $scope is and does.

I'll make a note to review the discussions about $scope, and see what I can do to improve it!
FitzChivalry2 (23) [Avatar] Offline
Oops. I don't think I did a very good job of explaining what I meant. I meant that the object "editing" was a user-generated (developer-generated, rather) object rather than one defined by AngularJS as having a specific meaning. For example, the object could have been called "setEditMode" instead of "editing," and it would have worked the same. Or maybe I'm off the mark, and it really is a reserved term that has a specific meaning? I'm only up to page 79, so maybe it'll become clearer as I move forward. smilie
jeremy.wilken (208) [Avatar] Offline
I think its more clear now what you meant. Yes, you can put anything you want onto the $scope object. It sounds like you understand it now, but in case someone else has a similar question here is more detail.

$scope.nobodyCaresWhatICallIt = true;
$scope.editing = true;
$scope.isEditing = true;

These are all developer generated properties of $scope. What really matters is that you use the value in your view.

<div ng-if="nobodyCaresWhatICallIt"></div>
<div ng-if="isEditing"></div>
<div ng-if="editing"></div>

These would work with the corresponding $scope property, so its really your call. $scope is a place for the developer to place any values that are needed to be shared in the view and controller. In this case the editing property is a boolean (true/false) to say if we are editing or not and the view changes which 'mode' we are in accordingly (editing or viewing).

And to be technical and picky about terminology, $scope.editing is not a variable. $scope is the variable (which references the scope object) and editing is a property on the scope object.