forked from angular/angular.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRouter.js
More file actions
150 lines (138 loc) · 4.24 KB
/
Router.js
File metadata and controls
150 lines (138 loc) · 4.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/**
* @ngdoc module
* @name ngComponentRouter
* @installation
* ## Installation
*
* Currently, the **Component Router** module must be installed via `npm`, it is not yet available
* on Bower or the Google CDN.
*
* ```bash
* npm install @angular/router --save
* ```
*
* Include `angular_1_router.js` in your HTML:
* ```html
* <script src="/node_modules/@angular/router/angular1/angular_1_router.js"></script>
*```
*
* You also need to include ES6 shims to support running on Internet Explorer:
* ```html
* <!-- IE required polyfills, in this exact order -->
* <script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.33.3/es6-shim.min.js"></script>
* <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.20/system-polyfills.js"></script>
* <script src="https://npmcdn.com/angular2/es6/dev/src/testing/shims_for_IE.js"></script>
* ```
*
* Then load the module in your application by adding it as a dependent module:
*
* ```js
* angular.module('app', ['ngComponentRouter']);
* ```
*
* @description
*/
/**
* @ngdoc type
* @name Router
* @description
* A `Router` is responsible for mapping URLs to components.
*
* * Routers and "Routing Component" instances have a 1:1 correspondence.
* * The Router holds reference to one or more of Outlets.
* * There are two kinds of Router: {@link RootRouter} and {@link ChildRouter}.
*
* You can see the state of a router by inspecting the read-only field `router.navigating`.
* This may be useful for showing a spinner, for instance.
*
*/
/**
* @ngdoc type
* @name ChildRouter
* @description
*
* This type extends the {@link Router}.
*
* Apart from the **Top Level Component** ({@link $routerRootComponent}) which is associated with
* the {@link $rootRouter}, every **Routing Component** is associated with a `ChildRouter`,
* which manages the routing for that **Routing Component**.
*/
/**
* @ngdoc type
* @name RootRouter
* @description
*
* This type extends the {@link Router}.
*
* There is only one instance of this type in a Component Router application injectable as the
* {@link $rootRouter} service. This **Router** is associate with the **Top Level Component**
* ({@link $routerRootComponent}). It acts as the connection between the **Routers** and the **Location**.
*/
/**
* @ngdoc type
* @name ComponentInstruction
* @description
* A `ComponentInstruction` represents the route state for a single component. An `Instruction` is
* composed of a tree of these `ComponentInstruction`s.
*
* `ComponentInstructions` is a public API. Instances of `ComponentInstruction` are passed
* to route lifecycle hooks, like `$routerCanActivate`.
*
* You should not modify this object. It should be treated as immutable.
*/
/**
* @ngdoc type
* @name RouteDefinition
* @description
*
* Each item in the **RouteConfig** for a **Routing Component** is an instance of
* this type. It can have the following properties:
*
* * `path` or (`regex` and `serializer) - defines how to recognize and generate this route
* * `component`, `loader`, `redirectTo` (requires exactly one of these)
* * `name` - the name used to identify the **Route Definition** when generating links
* * `data` (optional)
*/
/**
* @ngdoc type
* @name RouteParams
* @description
* A map of parameters for a given route, passed as part of the {@link ComponentInstruction} to
* the Lifecycle Hooks, such as `$routerOnActivate` and `$routerOnDeactivate`.
*/
/**
* @ngdoc directive
* @name ngOutlet
* @priority 400
* restrict: AE
* @description
*
* The directive that identifies where the {@link Router} should render its **Components**.
*/
/**
* @name ngLink
* @description
*
* Lets you create links to different views, automatically generating the `href`.
*
* ## Use
* Provide an array of {@link RouteDefinition} names and extra parameter objects:
*
* ```html
* <a ng-link="['Parent', {param: 1}, 'Child']">Link to Child View</a>
* ````
*/
/**
* @ngdoc service
* @name $rootRouter
* @description
* The singleton instance of the {@link RootRouter} type, which is associated
* with the top level {@link $routerRootComponent}.
*/
/**
* @ngdoc service
* @name $routerRootComponent
* @description
*
* The top level **Routing Component** associated with the {@link $rootRouter}.
*/