From a79231dea6cd13849c1a72d447f367e8c5053537 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Fri, 29 Jul 2011 12:45:10 -0700 Subject: doc(guide): various fixes and improvements --- .../dev_guide.compiler.extending_compiler.ngdoc | 12 +++---- docs/content/guide/dev_guide.compiler.markup.ngdoc | 9 ++--- ...v_guide.compiler.widgets.creating_widgets.ngdoc | 8 ++--- .../guide/dev_guide.di.understanding_di.ngdoc | 10 ++---- .../guide/dev_guide.mvc.understanding_model.ngdoc | 2 +- docs/content/guide/dev_guide.overview.ngdoc | 14 +++----- .../dev_guide.services.testing_services.ngdoc | 41 ++++++++++++---------- 7 files changed, 43 insertions(+), 53 deletions(-) diff --git a/docs/content/guide/dev_guide.compiler.extending_compiler.ngdoc b/docs/content/guide/dev_guide.compiler.extending_compiler.ngdoc index 88a9a470..49e83b74 100644 --- a/docs/content/guide/dev_guide.compiler.extending_compiler.ngdoc +++ b/docs/content/guide/dev_guide.compiler.extending_compiler.ngdoc @@ -8,7 +8,7 @@ We want this HTML source:
    
- +
@@ -23,9 +23,9 @@ to produce this DOM: -That is, the new `` tag's `salutation` and `name` attributes should be transformed by -the compiler such that two `` tags display the values of the attributes, with CSS classes -applied to the output. +That is, the new `` tag's `salutation` and `name` attributes should be +transformed by the compiler such that two `` tags display the values of the attributes, with +CSS classes applied to the output. The following code snippet shows how to write a following widget definition that will be processed by the compiler. Note that you have to declare the {@link dev_guide.bootstrap namespace} `my` in @@ -41,9 +41,9 @@ angular.widget('my:greeter', function(compileElement){ var salutationSpan = angular.element(''); linkElement.append(salutationSpan); - linkElement.append(compiler.text(' ')); + linkElement.append(' '); linkElement.append(nameSpan); - linkElement.append(compiler.text('!')); + linkElement.append('!'); this.$watch(salutationExp, function(value){ salutationSpan.text(value); }); diff --git a/docs/content/guide/dev_guide.compiler.markup.ngdoc b/docs/content/guide/dev_guide.compiler.markup.ngdoc index a6f43586..b33d3260 100644 --- a/docs/content/guide/dev_guide.compiler.markup.ngdoc +++ b/docs/content/guide/dev_guide.compiler.markup.ngdoc @@ -57,12 +57,9 @@ angular.markup('---', function(text, textNode, parentElement) { var compiler = this; var index = text.indexOf('---'); if (index > -1) { - var before = compiler.text(text.substring(0, index)); - var hr = compiler.element('hr'); - var after = compiler.text(text.substring(index + 3)); - textNode.after(after); - textNode.after(hr); - textNode.after(before); + textNode.after(text.substring(index + 3)); + textNode.after(angular.element('
')); + textNode.after(text.substring(0, index)); textNode.remove(); } }); diff --git a/docs/content/guide/dev_guide.compiler.widgets.creating_widgets.ngdoc b/docs/content/guide/dev_guide.compiler.widgets.creating_widgets.ngdoc index 906e0127..674f98aa 100644 --- a/docs/content/guide/dev_guide.compiler.widgets.creating_widgets.ngdoc +++ b/docs/content/guide/dev_guide.compiler.widgets.creating_widgets.ngdoc @@ -11,7 +11,7 @@ expression and `alert()` the user with each new value:
 // An element widget
-
+
 
You can implement `my:watch` like this: @@ -36,8 +36,8 @@ Let's implement the same widget as in the example in Defining an Element Widget, an attribute that can be added to any existing DOM element:
-// An attribute widget (my-watch) in a div tag
-
text
+// An attribute widget (my:watch) in a div tag +
text
You can implement `my:watch` attribute like this:
@@ -45,7 +45,7 @@ angular.widget('@my:watch', function(expression, compileElement) {
   var compiler = this;
   return function(linkElement) {
     var currentScope = this;
-    currentScope.$watch(expression, function(value){
+    currentScope.$watch(expression, function(value) {
       alert(value);
     });
   };
diff --git a/docs/content/guide/dev_guide.di.understanding_di.ngdoc b/docs/content/guide/dev_guide.di.understanding_di.ngdoc
index ff2551f1..93aa407c 100644
--- a/docs/content/guide/dev_guide.di.understanding_di.ngdoc
+++ b/docs/content/guide/dev_guide.di.understanding_di.ngdoc
@@ -87,14 +87,8 @@ function fnB($window, serviceA_, name){};
 
If angular does not find a `$inject` annotation on the function, then it calls the `.toString()` -method and tries to infer what should be injected using the following rules: - -* Any argument starting with `$` is an angular service and will be added to the `$inject` property -array -* Any argument ending with `_` will be added to the `$inject` property array (angular strips the -`_`) -* All arguments following an argument which has neither `$` nor `_` , must not have `$` nor `_` -(these are free arguments for {@link http://en.wikipedia.org/wiki/Currying currying}) +method and tries to infer what should be injected by using function argument names as dependency +identifiers. **IMPORTANT** Minifiers/obfuscators change the names of function arguments and will therefore break the `$inject` diff --git a/docs/content/guide/dev_guide.mvc.understanding_model.ngdoc b/docs/content/guide/dev_guide.mvc.understanding_model.ngdoc index 4efb03ca..a35541d0 100644 --- a/docs/content/guide/dev_guide.mvc.understanding_model.ngdoc +++ b/docs/content/guide/dev_guide.mvc.understanding_model.ngdoc @@ -39,7 +39,7 @@ only, not recommended for real applications): Angular creates models implicitly (by creating a scope property and assigning it a suitable value) when processing the following template constructs: -* Form input, select, and textarea elements: +* Form input, select, textarea and other form elements: diff --git a/docs/content/guide/dev_guide.overview.ngdoc b/docs/content/guide/dev_guide.overview.ngdoc index 4a817921..f5db7f94 100644 --- a/docs/content/guide/dev_guide.overview.ngdoc +++ b/docs/content/guide/dev_guide.overview.ngdoc @@ -43,21 +43,17 @@ easier a web developer's life can if they're using angular: Invoice: -
-
+
+
- - + +
QuantityCost
-
+
Total: {{qty * cost | currency}}