Constructor
new AvenxGuard(contextopt)
Guards are constructed by the router, once per navigation, with the context for that navigation.
Subclasses that declare no constructor get this one, so an existing guard
written before contexts existed keeps working unchanged and simply gains
this.$context.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
context |
GuardContext |
<optional> |
The capabilities for this navigation. |
- Source:
Members
$bridges
The application's bridges, by name.
- Source:
$context :GuardContext
The capabilities this guard was given.
Type:
- GuardContext
- Source:
Methods
$bridge(name) → {any}
Looks a bridge up by name.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The registered bridge name. |
- Source:
Returns:
The bridge, or undefined.
- Type
- any
canActivate(toopt, fromopt, contextopt) → {boolean|string|object|Promise:.<(boolean:|string:|object:)>}
Determines whether the route can be activated. Can return a boolean (true to allow, false to abort), a string (to redirect), a custom control object (e.g. { cancel: true, silent: true } or { redirect: string, state?: object }), or a Promise resolving to any of these.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
to |
object |
<optional> |
The target route. |
from |
object |
<optional> |
The route being left. |
context |
GuardContext |
<optional> |
The capabilities for this navigation, also
available as |
- Source:
Returns:
The decision.