Skip to content

Commit 7e2e7b0

Browse files
committed
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.
1 parent ce80576 commit 7e2e7b0

File tree

5 files changed

+30
-21
lines changed

5 files changed

+30
-21
lines changed

docs/examples/book.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
controller: {{name}}<br />
2+
Book Id: {{params.bookId}}<br />

docs/examples/chapter.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
controller: {{name}}<br />
2+
Book Id: {{prams.bookId}}<br />
3+
Chapter Id: {{params.chapterId}}

src/formatters.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
* * {@link angular.formatter.index index} - Manages indexing into an HTML select widget
1414
* * {@link angular.formatter.json json} - Formats user input in JSON format
1515
* * {@link angular.formatter.list list} - Formats user input string as an array
16-
* * {@link angular.formatter.number} - Formats user input strings as a number
17-
* * {@link angular.formatter.trim} - Trims extras spaces from end of user input
16+
* * {@link angular.formatter.number number} - Formats user input strings as a number
17+
* * {@link angular.formatter.trim trim} - Trims extras spaces from end of user input
1818
*
1919
* For more information about how angular formatters work, and how to create your own formatters,
2020
* see {@link guide/dev_guide.templates.formatters Understanding Angular Formatters} in the angular

src/service/route.js

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,16 @@
2222
<doc:example>
2323
<doc:source>
2424
<script>
25-
angular.service('myApp', function($route) {
26-
$route.when('/Book/:bookId', {template:'rsrc/book.html', controller:BookCntl});
27-
$route.when('/Book/:bookId/ch/:chapterId', {template:'rsrc/chapter.html', controller:ChapterCntl});
25+
function MainCntl($route, $location) {
26+
this.$route = $route;
27+
this.$location = $location;
28+
29+
$route.when('/Book/:bookId', {template: 'examples/book.html', controller: BookCntl});
30+
$route.when('/Book/:bookId/ch/:chapterId', {template: 'examples/chapter.html', controller: ChapterCntl});
2831
$route.onChange(function() {
2932
$route.current.scope.params = $route.current.params;
3033
});
31-
}, {$inject: ['$route']});
34+
}
3235
3336
function BookCntl() {
3437
this.name = "BookCntl";
@@ -39,18 +42,19 @@
3942
}
4043
</script>
4144
42-
Chose:
43-
<a href="#/Book/Moby">Moby</a> |
44-
<a href="#/Book/Moby/ch/1">Moby: Ch1</a> |
45-
<a href="#/Book/Gatsby">Gatsby</a> |
46-
<a href="#/Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a><br/>
47-
<input type="text" name="$location.hashPath" size="80" />
48-
<pre>$location={{$location}}</pre>
49-
<pre>$route.current.template={{$route.current.template}}</pre>
50-
<pre>$route.current.params={{$route.current.params}}</pre>
51-
<pre>$route.current.scope.name={{$route.current.scope.name}}</pre>
52-
<hr/>
53-
<ng:include src="$route.current.template" scope="$route.current.scope"/>
45+
<div ng:controller="MainCntl">
46+
Choose:
47+
<a href="#/Book/Moby">Moby</a> |
48+
<a href="#/Book/Moby/ch/1">Moby: Ch1</a> |
49+
<a href="#/Book/Gatsby">Gatsby</a> |
50+
<a href="#/Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a><br/>
51+
$location.hashPath: <input type="text" name="$location.hashPath" size="80" />
52+
<pre>$route.current.template = {{$route.current.template}}</pre>
53+
<pre>$route.current.params = {{$route.current.params}}</pre>
54+
<pre>$route.current.scope.name = {{$route.current.scope.name}}</pre>
55+
<hr />
56+
<ng:view></ng:view>
57+
</div>
5458
</doc:source>
5559
<doc:scenario>
5660
</doc:scenario>

src/widgets.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -597,9 +597,9 @@ angularWidget('button', inputWidgetSelector);
597597
* @param {comprehension_expression} comprehension _expresion_ `for` _item_ `in` _array_.
598598
*
599599
* * _array_: an expression which evaluates to an array of objects to bind.
600-
* * _item_: local variable which will reffer to the item in the _array_ during the itteration
601-
* * _expression_: The result of this expression will is `option` label. The
602-
* `expression` most likely reffers to the _item_ varibale.
600+
* * _item_: local variable which will refer to the item in the _array_ during the iteration
601+
* * _expression_: The result of this expression will be `option` label. The
602+
* `expression` most likely refers to the _item_ variable.
603603
*
604604
* @example
605605
<doc:example>

0 commit comments

Comments
 (0)