Home Identifier Source Repository
public class | since 0.0.1 | source

$APIRouteProvider

You can directly use instance of this class. $APIRouteProvider

Extends:

$RouteProvider → $APIRouteProvider

$APIRouteProvider is an abstraction on top of the default Angie $RouteProvider. It is included as "$APIRoutes" and has the same functionality as $Routes with the exception that it prevents the inclusion of the template and templatePath properties in the declaration of application routes. These properties make no sense in the RESTful world.

TODO:

  • use Symbols for RegExp store

Static Method Summary

Static Public Methods
public static

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

An alias of the $RouteProvider.when method

since 0.0.1

Static Public Methods

public static when(str: string | Object, obj: Object): function since 0.0.1 source

An alias of the $RouteProvider.when method

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:

$APIRoutes.when('/test', {
    Controller: 'TestCtrl',
    test2: {
        Controller: 'Test2Ctrl'
    }
});