Usage
Signature:
class UrlPathAdapter<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 UrlPathAdapter= require("ojs/ojurlpathadapter");
For additional information visit:
Constructor
new UrlPathAdapter(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.Route.<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
object <optional>
url
string <optional>
Optional URL to use. If not specified, document.location.pathname is used. Returns:
An array of routes starting from the path for the given router.
- Type
- Array.<CoreRouter.Route.<P>>
-
getUrlForRoutes(routes) : {string}
-
Build the URL path for the given routes.
Parameters:
Name Type Description routes
Array.<CoreRouter.Route.<P>> The set of routes from which the URL will be built. Returns:
The full URL representative of the given routes
- Type
- string