344 lines
		
	
	
		
			5.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			344 lines
		
	
	
		
			5.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| 
 | |
| p.location-badge.
 | |
|   exported from <a href='../router'>angular2/router</a>
 | |
|   defined in <a href="https://github.com/angular/angular/tree/2.0.0-alpha.36/modules/angular2/src/router/router.ts#L27-L439">angular2/src/router/router.ts (line 27)</a>
 | |
| 
 | |
| :markdown
 | |
|   Maps application URLs into application states, to support deep-linking and navigation.
 | |
| .l-main-section
 | |
|   h2 Members
 | |
|   .l-sub-section
 | |
|     h3 constructor
 | |
| 
 | |
|     
 | |
|     pre.prettyprint
 | |
|       code.
 | |
|         constructor(registry: RouteRegistry, _pipeline: Pipeline, parent: Router, hostComponent: any)
 | |
|     
 | |
|     :markdown
 | |
|       
 | |
|       
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|   .l-sub-section
 | |
|     h3 navigating
 | |
| 
 | |
|     
 | |
|     :markdown
 | |
|       
 | |
|       
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|   .l-sub-section
 | |
|     h3 lastNavigationAttempt
 | |
| 
 | |
|     
 | |
|     :markdown
 | |
|       
 | |
|       
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|   .l-sub-section
 | |
|     h3 registry
 | |
| 
 | |
|     
 | |
|     :markdown
 | |
|       
 | |
|       
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|   .l-sub-section
 | |
|     h3 parent
 | |
| 
 | |
|     
 | |
|     :markdown
 | |
|       
 | |
|       
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|   .l-sub-section
 | |
|     h3 hostComponent
 | |
| 
 | |
|     
 | |
|     :markdown
 | |
|       
 | |
|       
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|   .l-sub-section
 | |
|     h3 childRouter
 | |
| 
 | |
|     
 | |
|     pre.prettyprint
 | |
|       code.
 | |
|         childRouter(hostComponent: any)
 | |
|     
 | |
|     :markdown
 | |
|       Constructs a child router. You probably don't need to use this unless you're writing a reusable
 | |
|       component.
 | |
|       
 | |
|       
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|   .l-sub-section
 | |
|     h3 auxRouter
 | |
| 
 | |
|     
 | |
|     pre.prettyprint
 | |
|       code.
 | |
|         auxRouter(hostComponent: any)
 | |
|     
 | |
|     :markdown
 | |
|       Constructs a child router. You probably don't need to use this unless you're writing a reusable
 | |
|       component.
 | |
|       
 | |
|       
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|   .l-sub-section
 | |
|     h3 registerPrimaryOutlet
 | |
| 
 | |
|     
 | |
|     pre.prettyprint
 | |
|       code.
 | |
|         registerPrimaryOutlet(outlet: RouterOutlet)
 | |
|     
 | |
|     :markdown
 | |
|       Register an outlet to notified of primary route changes.
 | |
|       
 | |
|       You probably don't need to use this unless you're writing a reusable component.
 | |
|       
 | |
|       
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|   .l-sub-section
 | |
|     h3 registerAuxOutlet
 | |
| 
 | |
|     
 | |
|     pre.prettyprint
 | |
|       code.
 | |
|         registerAuxOutlet(outlet: RouterOutlet)
 | |
|     
 | |
|     :markdown
 | |
|       Register an outlet to notified of auxiliary route changes.
 | |
|       
 | |
|       You probably don't need to use this unless you're writing a reusable component.
 | |
|       
 | |
|       
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|   .l-sub-section
 | |
|     h3 isRouteActive
 | |
| 
 | |
|     
 | |
|     pre.prettyprint
 | |
|       code.
 | |
|         isRouteActive(instruction: Instruction)
 | |
|     
 | |
|     :markdown
 | |
|       Given an instruction, returns `true` if the instruction is currently active,
 | |
|       otherwise `false`.
 | |
|       
 | |
|       
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|   .l-sub-section
 | |
|     h3 config
 | |
| 
 | |
|     
 | |
|     pre.prettyprint
 | |
|       code.
 | |
|         config(definitions: RouteDefinition[])
 | |
|     
 | |
|     :markdown
 | |
|       Dynamically update the routing configuration and trigger a navigation.
 | |
|       
 | |
|       # Usage
 | |
|       
 | |
|       ```
 | |
|       router.config([
 | |
|         { 'path': '/', 'component': IndexComp },
 | |
|         { 'path': '/user/:id', 'component': UserComp },
 | |
|       ]);
 | |
|       ```
 | |
|       
 | |
|       
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|   .l-sub-section
 | |
|     h3 navigate
 | |
| 
 | |
|     
 | |
|     pre.prettyprint
 | |
|       code.
 | |
|         navigate(url: string, _skipLocationChange?: boolean)
 | |
|     
 | |
|     :markdown
 | |
|       Navigate to a URL. Returns a promise that resolves when navigation is complete.
 | |
|       
 | |
|       If the given URL begins with a `/`, router will navigate absolutely.
 | |
|       If the given URL does not begin with `/`, the router will navigate relative to this component.
 | |
|       
 | |
|       
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|   .l-sub-section
 | |
|     h3 navigateInstruction
 | |
| 
 | |
|     
 | |
|     pre.prettyprint
 | |
|       code.
 | |
|         navigateInstruction(instruction: Instruction, _skipLocationChange?: boolean)
 | |
|     
 | |
|     :markdown
 | |
|       Navigate via the provided instruction. Returns a promise that resolves when navigation is
 | |
|       complete.
 | |
|       
 | |
|       
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|   .l-sub-section
 | |
|     h3 commit
 | |
| 
 | |
|     
 | |
|     pre.prettyprint
 | |
|       code.
 | |
|         commit(instruction: Instruction, _skipLocationChange?: boolean)
 | |
|     
 | |
|     :markdown
 | |
|       Updates this router and all descendant routers according to the given instruction
 | |
|       
 | |
|       
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|   .l-sub-section
 | |
|     h3 subscribe
 | |
| 
 | |
|     
 | |
|     pre.prettyprint
 | |
|       code.
 | |
|         subscribe(onNext: (value: any) => void)
 | |
|     
 | |
|     :markdown
 | |
|       Subscribe to URL updates from the router
 | |
|       
 | |
|       
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|   .l-sub-section
 | |
|     h3 deactivate
 | |
| 
 | |
|     
 | |
|     pre.prettyprint
 | |
|       code.
 | |
|         deactivate(instruction: Instruction)
 | |
|     
 | |
|     :markdown
 | |
|       Removes the contents of this router's outlet and all descendant outlets
 | |
|       
 | |
|       
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|   .l-sub-section
 | |
|     h3 recognize
 | |
| 
 | |
|     
 | |
|     pre.prettyprint
 | |
|       code.
 | |
|         recognize(url: string)
 | |
|     
 | |
|     :markdown
 | |
|       Given a URL, returns an instruction representing the component graph
 | |
|       
 | |
|       
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|   .l-sub-section
 | |
|     h3 renavigate
 | |
| 
 | |
|     
 | |
|     pre.prettyprint
 | |
|       code.
 | |
|         renavigate()
 | |
|     
 | |
|     :markdown
 | |
|       Navigates to either the last URL successfully navigated to, or the last URL requested if the
 | |
|       router has yet to successfully navigate.
 | |
|       
 | |
|       
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|   .l-sub-section
 | |
|     h3 generate
 | |
| 
 | |
|     
 | |
|     pre.prettyprint
 | |
|       code.
 | |
|         generate(linkParams: any[])
 | |
|     
 | |
|     :markdown
 | |
|       Generate a URL from a component name and optional map of parameters. The URL is relative to the
 | |
|       app's base href.
 | |
|       
 | |
|       
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 |