Skip to content

Commit 6a336ba

Browse files
docs(guide/component-router): initial draft for component router 0.2.0
Closes angular#14131
1 parent 67a9811 commit 6a336ba

10 files changed

+1179
-1
lines changed

docs/content/guide/component-router.ngdoc

+1,044
Large diffs are not rendered by default.

docs/img/guide/component-based-architecture.svg

+4
Loading

docs/img/guide/component-hierarchy.svg

+4
Loading

docs/img/guide/component-routes.svg

+4
Loading

docs/img/guide/crisis-detail.png

32.9 KB
Loading

docs/img/guide/crisis-list.png

38.6 KB
Loading

docs/img/guide/hero-detail.png

27.5 KB
Loading

docs/img/guide/heroes-list.png

29.9 KB
Loading

lib/grunt/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ module.exports = {
287287
rewrite: function(){
288288
return function(req, res, next){
289289
var REWRITE = /\/(guide|api|cookbook|misc|tutorial|error).*$/,
290-
IGNORED = /(\.(css|js|png|jpg|gif)$|partials\/.*\.html$)/,
290+
IGNORED = /(\.(css|js|png|jpg|gif|svg)$|partials\/.*\.html$)/,
291291
match;
292292

293293
if (!IGNORED.test(req.url) && (match = req.url.match(REWRITE))) {

src/ngComponentRouter/Router.js

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
/**
2+
* @ngdoc module
3+
* @name ngComponentRouter
4+
* @description
5+
* The new Angular Router
6+
*/
7+
8+
/**
9+
* @ngdoc type
10+
* @name Router
11+
* @description
12+
* A `Router` is responsible for mapping URLs to components.
13+
*
14+
* * Routers and "Routing Component" instances have a 1:1 correspondence.
15+
* * The Router holds reference to one or more of Outlets.
16+
* * There are two kinds of Router: {@link RootRouter} and {@link ChildRouter}.
17+
*
18+
* You can see the state of a router by inspecting the read-only field `router.navigating`.
19+
* This may be useful for showing a spinner, for instance.
20+
*
21+
*/
22+
23+
/**
24+
* @ngdoc type
25+
* @name ChildRouter
26+
* @description
27+
*
28+
* This type extends the {@link Router}.
29+
*
30+
* Apart from the **Top Level Component** ({@link $routerRootComponent}) which is associated with
31+
* the {@link $rootRouter}, every **Routing Component** is associated with a `ChildRouter`,
32+
* which manages the routing for that **Routing Component**.
33+
*/
34+
35+
/**
36+
* @ngdoc type
37+
* @name RootRouter
38+
* @description
39+
*
40+
* This type extends the {@link Router}.
41+
*
42+
* There is only one instance of this type in a Component Router application injectable as the
43+
* {@link $rootRouter} service. This **Router** is associate with the **Top Level Component**
44+
* ({@link $routerRootComponent}). It acts as the connection betweent he **Routers** and the **Location**.
45+
*/
46+
47+
/**
48+
* @ngdoc type
49+
* @name ComponentInstruction
50+
* @description
51+
* A `ComponentInstruction` represents the route state for a single component. An `Instruction` is
52+
* composed of a tree of these `ComponentInstruction`s.
53+
*
54+
* `ComponentInstructions` is a public API. Instances of `ComponentInstruction` are passed
55+
* to route lifecycle hooks, like `$routerCanActivate`.
56+
*
57+
* You should not modify this object. It should be treated as immutable.
58+
*/
59+
60+
/**
61+
* @ngdoc type
62+
* @name RouteDefinition
63+
* @description
64+
*
65+
* Each item in a the **RouteConfig** for a **Routing Component** is an instance of
66+
* this type. It can have the following properties:
67+
*
68+
* * `path` or (`regex` and `serializer) - defines how to recognize and generate this route
69+
* * `component`, `loader`, `redirectTo` (requires exactly one of these)
70+
* * `name` - the name used to identify the **Route Definition** when generating links
71+
* * `data` (optional)
72+
*/
73+
74+
/**
75+
* @ngdoc type
76+
* @name RouteParams
77+
* @description
78+
* A map of parameters for a given route, passed as part of the {@link ComponentInstruction} to
79+
* the Lifecycle Hooks, such as `$routerOnActivate` and `$routerOnDeactivate`.
80+
*/
81+
82+
/**
83+
* @ngdoc directive
84+
* @name ngOutlet
85+
* @priority 400
86+
* restrict: AE
87+
* @description
88+
*
89+
* The directive that identifies where the {@link Router} should render its **Components**.
90+
*/
91+
92+
/**
93+
* @name ngLink
94+
* @description
95+
*
96+
* Lets you create links to different views, automatically generating the `href`.
97+
*
98+
* ## Use
99+
* Provide an array of {@link RouteDefinition} names and extra parameter objects:
100+
*
101+
* ```html
102+
* <a ng-link="['Parent', {param: 1}, 'Child']">Link to Child View</a>
103+
* ````
104+
*/
105+
106+
107+
/**
108+
* @ngdoc service
109+
* @name $rootRouter
110+
* @description
111+
* The singleton instance of the {@link RootRouter} type, which is associated
112+
* with the top level {@link $routerRootComponent}.
113+
*/
114+
115+
116+
/**
117+
* @ngdoc service
118+
* @name $routerRootComponent
119+
* @description
120+
*
121+
* The top level **Routing Component** associated with the {@link $rootRouter}.
122+
*/

0 commit comments

Comments
 (0)