From 5d70e4a89cd9b3d430bb81f438cf03e956d9a9d2 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Sun, 10 Jun 2012 09:01:42 -0700 Subject: docs(*): fix various outdated docs and examples Closes #1030 --- docs/content/guide/dev_guide.services.$location.ngdoc | 4 ++-- .../dev_guide.templates.filters.creating_filters.ngdoc | 14 ++++---------- docs/content/guide/dev_guide.unit-testing.ngdoc | 14 +++++++------- docs/content/guide/expression.ngdoc | 8 ++++---- 4 files changed, 17 insertions(+), 23 deletions(-) (limited to 'docs/content/guide') diff --git a/docs/content/guide/dev_guide.services.$location.ngdoc b/docs/content/guide/dev_guide.services.$location.ngdoc index c5396b11..209b3abc 100644 --- a/docs/content/guide/dev_guide.services.$location.ngdoc +++ b/docs/content/guide/dev_guide.services.$location.ngdoc @@ -622,11 +622,11 @@ example:
// js - controller
-this.$watch('locationPath', function(path) {
+$scope.$watch('locationPath', function(path) {
$location.path(path);
});
-this.$watch('$location.path()', function(path) {
+$scope.$watch('$location.path()', function(path) {
scope.locationPath = path;
});
diff --git a/docs/content/guide/dev_guide.templates.filters.creating_filters.ngdoc b/docs/content/guide/dev_guide.templates.filters.creating_filters.ngdoc
index 9ec6fdab..b21e6f0c 100644
--- a/docs/content/guide/dev_guide.templates.filters.creating_filters.ngdoc
+++ b/docs/content/guide/dev_guide.templates.filters.creating_filters.ngdoc
@@ -2,16 +2,10 @@
@name Developer Guide: Templates: Filters: Creating Angular Filters
@description
-Writing your own filter is very easy: just define a JavaScript function on the `angular.module.ng.$filter`
-object.
-The framework passes in the input value as the first argument to your function. Any filter
-arguments are passed in as additional function arguments.
-
-You can use these variables in the function:
-
-* `this` — The current scope.
-* `this.$element` — The DOM element containing the binding. The `$element` variable allows the
-filter to manipulate the DOM.
+Writing your own filter is very easy: just register a new filter (injectable) factory function with
+your module. This factory function should return a new filter function which takes the input value
+as the first argument. Any filter arguments are passed in as additional arguments to the filter
+function.
The following sample filter reverses a text string. In addition, it conditionally makes the
text upper-case and assigns color.
diff --git a/docs/content/guide/dev_guide.unit-testing.ngdoc b/docs/content/guide/dev_guide.unit-testing.ngdoc
index f9e148eb..2083f2e4 100644
--- a/docs/content/guide/dev_guide.unit-testing.ngdoc
+++ b/docs/content/guide/dev_guide.unit-testing.ngdoc
@@ -218,16 +218,16 @@ In angular the controllers are strictly separated from the DOM manipulation logi
a much easier testability story as can be seen in this example:
-function PasswordCntrl() {
- this.password = '';
- this.grade = function() {
- var size = this.password.length;
+function PasswordCntrl($scope) {
+ $scope.password = '';
+ $scope.grade = function() {
+ var size = $scope.password.length;
if (size > 8) {
- this.strength = 'strong';
+ $scope.strength = 'strong';
} else if (size > 3) {
- this.strength = 'medium';
+ $scope.strength = 'medium';
} else {
- this.strength = 'weak';
+ $scope.strength = 'weak';
}
};
}
diff --git a/docs/content/guide/expression.ngdoc b/docs/content/guide/expression.ngdoc
index f92dbe48..28edcc22 100644
--- a/docs/content/guide/expression.ngdoc
+++ b/docs/content/guide/expression.ngdoc
@@ -55,14 +55,14 @@ You can try evaluating different expressions here:
@@ -104,7 +104,7 @@ prevent accidental access to the global state (a common source of subtle bugs).
$scope.name = 'World';
$scope.greet = function() {
- ($window.mockWindow || $window).alert('Hello ' + this.name);
+ ($window.mockWindow || $window).alert('Hello ' + $scope.name);
}
}
--
cgit v1.2.3