Usage
Signature:
class KnockoutRouterAdapter<D extends {[key: string]: any} = {[key: string]: any}, P extends {[key: string]: any} = {[key: string]: any}>
Generic Parameters
Parameter Description D Detail object for the router state P Parameters object for the router state
Typescript Import Format
//This class is exported directly as module. To import it
import KnockoutRouterAdapter= require("ojs/ojknockoutrouteradapter");
For additional information visit:
Constructor
new KnockoutRouterAdapter(router)
Constructor
Parameters:
Name | Type | Description |
---|---|---|
router |
CoreRouter.<D, P> | The CoreRouter instance on which this adapter will listen for state changes. |
Fields
-
(readonly) path :ko.Observable.<string>
-
An observable containing the current value of CoreRouterState#path. This observable can be used in two-way bindings to read the value of the current state, as well as navigate the router to a new path. When this observable's value changes, the underlying CoreRouter#go method is called with the new value as the path.
-
(readonly) state :ko.Observable<CoreRouter.CoreRouterState<D, P>>
-
An observable containing the current CoreRouterState from the router, if defined. Note that this CoreRouterState's
path
is the original string value from the class, and can only be used read-only. In order to navigate the router from a component value using two-way binding, use the observable KnockoutRouterAdapter#path instead. This observable is read-only, and may not be written to.