Home Identifier Source Repository
import $RouteProvider from 'angie/src/factories/$RouteProvider.js'
public class | since 0.0.1 | source

$RouteProvider

You can directly use instance of this class. $RouteProvider

$RouteProvider is provided to any service, Controller, directive, Model, or view which has included it as an argument as ""$Routes"

It can also be referenced as app.services.$Routes or imported as '$RouteProvider' from the Angie Path.

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

since 0.0.1
public static

when(str: string | Object, obj: Object): function

Sets up a route as a possible endpoint in an Angie application.

since 0.0.1

Static Public Methods

public static fetch(): object since 0.0.1 source

Returns all of the set application routes

Return:

object

Routes object (inc. RegExps) and otherwise path objects

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:

NameTypeAttributeDescription
path string

URL string to set as the "otherwise" path

Return:

string

The same URL string

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:

NameTypeAttributeDescription
str string | Object

String or RegExp to denote the endpoint path

obj Object
obj.templatePath string
  • nullable: true

Optional template path

obj.template string
  • nullable: true

Optional template html

obj.Controller string
  • nullable: true

The name of the associated Controller

obj.* object
  • nullable: true

A deep route with another route object to associate with a route consisting of the original path added to the new key

Return:

function

Template function, compiles in whatever scope is passed

Example:

$Routes.when('/test', {
    template: '<div>{{{test}}}</div>',
    Controller: 'TestCtrl',
    test2: {
        template: '<div>{{{test2}}}</div>',
        Controller: 'Test2Ctrl'
    }
});