From eaaf4967f9998399e5bea5b87f7b34e4f699ae2e Mon Sep 17 00:00:00 2001 From: nderoche Date: Thu, 27 Feb 2014 17:32:10 +0100 Subject: [PATCH] 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 --- src/ng/directive/ngController.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ng/directive/ngController.js b/src/ng/directive/ngController.js index cbe7e833..7130214c 100644 --- a/src/ng/directive/ngController.js +++ b/src/ng/directive/ngController.js @@ -123,16 +123,16 @@ {type:'email', value:'john.smith@example.org'} ]; $scope.greet = function() { - alert(this.name); + alert($scope.name); }; $scope.addContact = function() { - this.contacts.push({type:'email', value:'yourname@example.org'}); + $scope.contacts.push({type:'email', value:'yourname@example.org'}); }; $scope.removeContact = function(contactToRemove) { - var index = this.contacts.indexOf(contactToRemove); - this.contacts.splice(index, 1); + var index = $scope.contacts.indexOf(contactToRemove); + $scope.contacts.splice(index, 1); }; $scope.clearContact = function(contact) {