This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Component router guide #14131
Merged
petebacondarwin
merged 1 commit into
angular:master
from
petebacondarwin:component-router-guide
Mar 4, 2016
Merged
Component router guide #14131
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
/** | ||
* @ngdoc module | ||
* @name ngComponentRouter | ||
* @description | ||
* The new Angular Router | ||
*/ | ||
|
||
/** | ||
* @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 betweent he **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 a 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}. | ||
*/ |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sample code used here for configuring routes and the ngLink is incorrect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes - work in progress :-)