aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVojta Jina2011-07-02 01:38:03 +0200
committerVojta Jina2011-07-13 11:49:16 +0200
commit7e2e7b07b6a79a64891f3f2408fb6c325a499e51 (patch)
treebf39157ba4ec22368abd8f0a924c37c21693d0dd
parentce80576e0b8ac9ed5a5b1f1a4dbc2446434a0002 (diff)
downloadangular.js-7e2e7b07b6a79a64891f3f2408fb6c325a499e51.tar.bz2
doc($route): fix $route example and couple of typos
Rewrite $route example a bit, as it required $location and $route services to be eager published in the root scope. Fix small typos in formatter and ng:options docs.
-rw-r--r--docs/examples/book.html2
-rw-r--r--docs/examples/chapter.html3
-rw-r--r--src/formatters.js4
-rw-r--r--src/service/route.js36
-rw-r--r--src/widgets.js6
5 files changed, 30 insertions, 21 deletions
diff --git a/docs/examples/book.html b/docs/examples/book.html
new file mode 100644
index 00000000..10d4dd91
--- /dev/null
+++ b/docs/examples/book.html
@@ -0,0 +1,2 @@
+controller: {{name}}<br />
+Book Id: {{params.bookId}}<br />
diff --git a/docs/examples/chapter.html b/docs/examples/chapter.html
new file mode 100644
index 00000000..5f11f704
--- /dev/null
+++ b/docs/examples/chapter.html
@@ -0,0 +1,3 @@
+controller: {{name}}<br />
+Book Id: {{prams.bookId}}<br />
+Chapter Id: {{params.chapterId}}
diff --git a/src/formatters.js b/src/formatters.js
index 3eb71bfd..87d4602f 100644
--- a/src/formatters.js
+++ b/src/formatters.js
@@ -13,8 +13,8 @@
* * {@link angular.formatter.index index} - Manages indexing into an HTML select widget
* * {@link angular.formatter.json json} - Formats user input in JSON format
* * {@link angular.formatter.list list} - Formats user input string as an array
- * * {@link angular.formatter.number} - Formats user input strings as a number
- * * {@link angular.formatter.trim} - Trims extras spaces from end of user input
+ * * {@link angular.formatter.number number} - Formats user input strings as a number
+ * * {@link angular.formatter.trim trim} - Trims extras spaces from end of user input
*
* For more information about how angular formatters work, and how to create your own formatters,
* see {@link guide/dev_guide.templates.formatters Understanding Angular Formatters} in the angular
diff --git a/src/service/route.js b/src/service/route.js
index 19fc81bf..b04c5ebb 100644
--- a/src/service/route.js
+++ b/src/service/route.js
@@ -22,13 +22,16 @@
<doc:example>
<doc:source>
<script>
- angular.service('myApp', function($route) {
- $route.when('/Book/:bookId', {template:'rsrc/book.html', controller:BookCntl});
- $route.when('/Book/:bookId/ch/:chapterId', {template:'rsrc/chapter.html', controller:ChapterCntl});
+ function MainCntl($route, $location) {
+ this.$route = $route;
+ this.$location = $location;
+
+ $route.when('/Book/:bookId', {template: 'examples/book.html', controller: BookCntl});
+ $route.when('/Book/:bookId/ch/:chapterId', {template: 'examples/chapter.html', controller: ChapterCntl});
$route.onChange(function() {
$route.current.scope.params = $route.current.params;
});
- }, {$inject: ['$route']});
+ }
function BookCntl() {
this.name = "BookCntl";
@@ -39,18 +42,19 @@
}
</script>
- Chose:
- <a href="#/Book/Moby">Moby</a> |
- <a href="#/Book/Moby/ch/1">Moby: Ch1</a> |
- <a href="#/Book/Gatsby">Gatsby</a> |
- <a href="#/Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a><br/>
- <input type="text" name="$location.hashPath" size="80" />
- <pre>$location={{$location}}</pre>
- <pre>$route.current.template={{$route.current.template}}</pre>
- <pre>$route.current.params={{$route.current.params}}</pre>
- <pre>$route.current.scope.name={{$route.current.scope.name}}</pre>
- <hr/>
- <ng:include src="$route.current.template" scope="$route.current.scope"/>
+ <div ng:controller="MainCntl">
+ Choose:
+ <a href="#/Book/Moby">Moby</a> |
+ <a href="#/Book/Moby/ch/1">Moby: Ch1</a> |
+ <a href="#/Book/Gatsby">Gatsby</a> |
+ <a href="#/Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a><br/>
+ $location.hashPath: <input type="text" name="$location.hashPath" size="80" />
+ <pre>$route.current.template = {{$route.current.template}}</pre>
+ <pre>$route.current.params = {{$route.current.params}}</pre>
+ <pre>$route.current.scope.name = {{$route.current.scope.name}}</pre>
+ <hr />
+ <ng:view></ng:view>
+ </div>
</doc:source>
<doc:scenario>
</doc:scenario>
diff --git a/src/widgets.js b/src/widgets.js
index 3e1d6f55..3a7fa2a3 100644
--- a/src/widgets.js
+++ b/src/widgets.js
@@ -597,9 +597,9 @@ angularWidget('button', inputWidgetSelector);
* @param {comprehension_expression} comprehension _expresion_ `for` _item_ `in` _array_.
*
* * _array_: an expression which evaluates to an array of objects to bind.
- * * _item_: local variable which will reffer to the item in the _array_ during the itteration
- * * _expression_: The result of this expression will is `option` label. The
- * `expression` most likely reffers to the _item_ varibale.
+ * * _item_: local variable which will refer to the item in the _array_ during the iteration
+ * * _expression_: The result of this expression will be `option` label. The
+ * `expression` most likely refers to the _item_ variable.
*
* @example
<doc:example>