aboutsummaryrefslogtreecommitdiffstats
path: root/docs/content/cookbook
diff options
context:
space:
mode:
authorIgor Minar2012-06-10 09:01:42 -0700
committerIgor Minar2012-06-10 09:01:42 -0700
commit5d70e4a89cd9b3d430bb81f438cf03e956d9a9d2 (patch)
tree2a9311d9735c938321e581b22fb3e06c40839385 /docs/content/cookbook
parentb5bba65a9353ca9dc03b8d0c3c9b06d9c4cdacdf (diff)
downloadangular.js-5d70e4a89cd9b3d430bb81f438cf03e956d9a9d2.tar.bz2
docs(*): fix various outdated docs and examples
Closes #1030
Diffstat (limited to 'docs/content/cookbook')
-rw-r--r--docs/content/cookbook/buzz.ngdoc12
-rw-r--r--docs/content/cookbook/form.ngdoc8
-rw-r--r--docs/content/cookbook/mvc.ngdoc7
3 files changed, 14 insertions, 13 deletions
diff --git a/docs/content/cookbook/buzz.ngdoc b/docs/content/cookbook/buzz.ngdoc
index bf900223..7277f957 100644
--- a/docs/content/cookbook/buzz.ngdoc
+++ b/docs/content/cookbook/buzz.ngdoc
@@ -12,10 +12,10 @@ to retrieve Buzz activity and comments.
<doc:example>
<doc:source>
<script>
- BuzzController.$inject = ['$resource'];
- function BuzzController($resource) {
- this.userId = 'googlebuzz';
- this.Activity = $resource(
+ BuzzController.$inject = ['$scope', '$resource'];
+ function BuzzController($scope, $resource) {
+ $scope.userId = 'googlebuzz';
+ $scope.Activity = $resource(
'https://www.googleapis.com/buzz/v1/activities/:userId/:visibility/:activityId/:comments',
{alt: 'json', callback: 'JSON_CALLBACK'},
{ get: {method: 'JSONP', params: {visibility: '@self'}},
@@ -24,10 +24,10 @@ to retrieve Buzz activity and comments.
}
BuzzController.prototype = {
fetch: function() {
- this.activities = this.Activity.get({userId:this.userId});
+ $scope.activities = $scope.Activity.get({userId:this.userId});
},
expandReplies: function(activity) {
- activity.replies = this.Activity.replies({userId: this.userId, activityId: activity.id});
+ activity.replies = $scope.Activity.replies({userId: this.userId, activityId: activity.id});
}
};
</script>
diff --git a/docs/content/cookbook/form.ngdoc b/docs/content/cookbook/form.ngdoc
index f746e327..829547f4 100644
--- a/docs/content/cookbook/form.ngdoc
+++ b/docs/content/cookbook/form.ngdoc
@@ -11,7 +11,7 @@ allow a user to enter data.
<doc:source>
<script>
function FormController($scope) {
- $scope.user = {
+ var user = $scope.user = {
name: 'John Smith',
address:{line1: '123 Main St.', city:'Anytown', state:'AA', zip:'12345'},
contacts:[{type:'phone', value:'1(234) 555-1212'}]
@@ -20,12 +20,12 @@ allow a user to enter data.
$scope.zip = /^\d\d\d\d\d$/;
$scope.addContact = function() {
- $scope.user.contacts.push({type:'email', value:''});
+ user.contacts.push({type:'email', value:''});
};
$scope.removeContact = function(contact) {
- for (var i = 0, ii = this.user.contacts.length; i < ii; i++) {
- if (contact === this.user.contacts[i]) {
+ for (var i = 0, ii = user.contacts.length; i < ii; i++) {
+ if (contact === user.contacts[i]) {
$scope.user.contacts.splice(i, 1);
}
}
diff --git a/docs/content/cookbook/mvc.ngdoc b/docs/content/cookbook/mvc.ngdoc
index 92033352..da8f48e2 100644
--- a/docs/content/cookbook/mvc.ngdoc
+++ b/docs/content/cookbook/mvc.ngdoc
@@ -6,9 +6,10 @@ MVC allows for a clean an testable separation between the behavior (controller)
(HTML template). A Controller is just a JavaScript class which is grafted onto the scope of the
view. This makes it very easy for the controller and the view to share the model.
-The model is simply the controller's this. This makes it very easy to test the controller in
-isolation since one can simply instantiate the controller and test without a view, because there is
-no connection between the controller and the view.
+The model is a set of objects and primitives that are referenced from the Scope ($scope) object.
+This makes it very easy to test the controller in isolation since one can simply instantiate the
+controller and test without a view, because there is no connection between the controller and the
+view.
<doc:example>