$Routes
$Routes is provided to any service, Controller, directive, Model, or view which has included it as an argument as "$Routes".
TODO:
- use Symbols for RegExp store
Static Method Summary
Static Public Methods | ||
public static |
Returns all of the set application routes |
since 0.0.1 |
public static |
Sets a defaulted path in the event that none of the other routes or route patterns are matching. |
since 0.0.1 |
public static |
Sets up a route as a possible endpoint in an Angie application. |
since 0.0.1 |
Static Public Methods
public static otherwise(path: string): string since 0.0.1 source
Sets a defaulted path in the event that none of the other routes or route patterns are matching. If this is a relative path, it will match absolutely. If this is a full path, it will result in a 301 redirect.
Params:
Name | Type | Attribute | Description |
path | string | URL string to set as the "otherwise" path |
Example:
$Route.otherwise('/test');
public static when(str: string | Object, obj: Object): function since 0.0.1 source
Sets up a route as a possible endpoint in an Angie application.
Params:
Name | Type | Attribute | Description |
str | string | Object | String or RegExp to denote the endpoint path. Supports RegExp flags |
|
obj | Object | ||
obj.templatePath | string |
|
Optional template path |
obj.template | string |
|
Optional template html |
obj.Controller | string |
|
The name of the associated Controller |
obj.* | object |
|
A deep route with another route object to associate with a route consisting of the original path added to the new key |
Example:
$Routes.when('/test', {
template: '<div>{{{test}}}</div>',
Controller: 'TestCtrl',
test2: {
template: '<div>{{{test2}}}</div>',
Controller: 'Test2Ctrl'
}
});