@ -2,17 +2,22 @@
|
||||
Routing and navigation
|
||||
@cheatsheetIndex 10
|
||||
@description
|
||||
`import {RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, ...} from 'angular2/router';`
|
||||
{@target js ts}`import {RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, ...} from 'angular2/router';`{@endtarget}
|
||||
{@target dart}`import 'package:angular2/angular2.dart';`{@endtarget}
|
||||
|
||||
|
||||
@cheatsheetItem
|
||||
syntax:
|
||||
syntax(js ts):
|
||||
`@RouteConfig([
|
||||
{ path: '/:myParam', component: MyComponent, as: 'MyCmp' },
|
||||
{ path: '/staticPath', component: ..., as: ...},
|
||||
{ path: '/*wildCardParam', component: ..., as: ...}
|
||||
])
|
||||
class MyComponent() {}`|`@RouteConfig`
|
||||
syntax(dart):
|
||||
`@RouteConfig(const [
|
||||
const Route(path: '/:myParam', component: MyComponent, name: 'MyCmp' ),
|
||||
])`
|
||||
description:
|
||||
Configures routes for the decorated component. Supports static, parameterized and wildcard routes.
|
||||
|
||||
@ -32,8 +37,10 @@ Creates a link to a different view based on a route instruction consisting of a
|
||||
|
||||
|
||||
@cheatsheetItem
|
||||
syntax:
|
||||
syntax(js ts):
|
||||
`@CanActivate(() => { ... })class MyComponent() {}`|`@CanActivate`
|
||||
syntax(dart):
|
||||
`@CanActivate(() => ...)class MyComponent() {}`|`@CanActivate`
|
||||
description:
|
||||
A component decorator defining a function that the router should call first to determine if it should activate this component. Should return a boolean or a promise.
|
||||
|
||||
@ -70,4 +77,4 @@ The router calls the routerCanDeactivate methods (if defined) of every component
|
||||
syntax:
|
||||
`routerOnDeactivate(nextInstruction, prevInstruction) { ... }`|`routerOnDeactivate`
|
||||
description:
|
||||
Called before the directive is removed as the result of a route change. May return a promise that pauses removing the directive until the promise resolves.
|
||||
Called before the directive is removed as the result of a route change. May return a promise that pauses removing the directive until the promise resolves.
|
||||
|
Reference in New Issue
Block a user