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

Commit 4f55834

Browse files
amirhhzbtford
authored andcommitted
docs(cookbook): change prototype methods to scope methods in Buzz
As explained in 'Understanding the Controller Component', Controllers written for new (post 1.0 RC) versions of Angular need to add methods to the scope directly, not the function's prototype. Correcting this example should remove any ambiguity, especially for beginners.
1 parent 75487ec commit 4f55834

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/content/cookbook/buzz.ngdoc

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ to retrieve Buzz activity and comments.
2121
{ get: {method: 'JSONP', params: {visibility: '@self'}},
2222
replies: {method: 'JSONP', params: {visibility: '@self', comments: '@comments'}}
2323
});
24-
}
25-
BuzzController.prototype = {
26-
fetch: function() {
24+
25+
$scope.fetch = function() {
2726
$scope.activities = $scope.Activity.get({userId:this.userId});
28-
},
29-
expandReplies: function(activity) {
27+
}
28+
29+
$scope.expandReplies = function(activity) {
3030
activity.replies = $scope.Activity.replies({userId: this.userId, activityId: activity.id});
3131
}
3232
};

0 commit comments

Comments
 (0)