mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-04 17:08:17 +08:00
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
This commit is contained in:
committed by
Peter Bacon Darwin
parent
f440ac7492
commit
eaaf4967f9
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user