Usage
Signature:
class UrlPathParamAdapter<P extends {[key: string]: any} = {[key: string]: any}>
Generic Parameters
Parameter Description P Parameters object for the router state
Typescript Import Format
//This class is exported directly as module. To import it
import UrlPathParamAdapter= require("ojs/ojurlpathparamadapter");
For additional information visit:
Constructor
new UrlPathParamAdapter(baseUrl)
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
baseUrl |
string |
<optional> |
The base URL from which the application is served. This value may be any string value (even blank). If not specified at all (undefined), then the adapter will use document.location.pathname as its base. |
Methods
-
getRoutesForUrl(routePathParams, url) : {Array.<CoreRouter.CoreRouterState<P>>}
-
Build all routes for the given URL. The URL is expected to start with the
baseUrl
set for this adapter, because it will be subtracted out before routes are built.Parameters:
Name Type Argument Description routePathParams
{offset: number, pathParams: Array.<string>} <optional>
An object containing the offset within the URL segments and the path parameters for the state. url
string <optional>
Optional URL to use. If not specified, document.location.pathname is used. Returns:
An array of states starting from the path for the given router.
- Type
- Array.<CoreRouter.CoreRouterState<P>>
-
getUrlForRoutes(states) : {string}
-
Build the URL path for the given routes.
Parameters:
Name Type Description states
Array.<CoreRouter.CoreRouterState<P>> The set of states from which the URL will be built. Returns:
The full URL representative of the given routes
- Type
- string