Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit d85c5e9

Browse files
nderochepetebacondarwin
authored andcommitted
docs(ngController): clarify that this is $scope in example
Replace `this` with `$scope` in second example to highlight the fact that we are working with the `$scope` instead of an instance of the controller in this example. Closes #6478
1 parent c2c9d52 commit d85c5e9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/ng/directive/ngController.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,16 @@
123123
{type:'email', value:'john.smith@example.org'} ];
124124
125125
$scope.greet = function() {
126-
alert(this.name);
126+
alert($scope.name);
127127
};
128128
129129
$scope.addContact = function() {
130-
this.contacts.push({type:'email', value:'yourname@example.org'});
130+
$scope.contacts.push({type:'email', value:'yourname@example.org'});
131131
};
132132
133133
$scope.removeContact = function(contactToRemove) {
134-
var index = this.contacts.indexOf(contactToRemove);
135-
this.contacts.splice(index, 1);
134+
var index = $scope.contacts.indexOf(contactToRemove);
135+
$scope.contacts.splice(index, 1);
136136
};
137137
138138
$scope.clearContact = function(contact) {

0 commit comments

Comments
 (0)