From 09923afb4ace1121469a863459dde83e0ca5379b Mon Sep 17 00:00:00 2001 From: caseyWebb Date: Mon, 13 Jun 2016 22:19:42 -0400 Subject: [PATCH] hirearchy --- docs/bindings.md | 14 +++++++------- docs/config.md | 14 +++++++------- docs/context.md | 36 ++++++++++++++++++------------------ 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/docs/bindings.md b/docs/bindings.md index 8d4a5b8..8eae664 100644 --- a/docs/bindings.md +++ b/docs/bindings.md @@ -6,13 +6,13 @@ of `ctx.update`. These bindings use that function behind the scenes, so it shoul surprise that they support the same bubbling behavior, however you can [lock the context](#locking-to-a-context) if necessary. -## Usage +#### Usage ```html
``` -#### Locking to a Context +##### Locking to a Context In certain cases, the default route bubbling behavior may not be quite right, and in those cases you need to nudge the router in the right direction. You can accomplish @@ -26,20 +26,20 @@ that with `..`, `./`, `//` following idiomatic path modifiers. `//` forces top-down traversal rather than bottom-up. For all intents and purposes this can be regarded as a "absolute path" prefix with respect to the base path. -#### Styling +##### Styling For convenience, elements with path bindings that match the current route have the `active-path` class added. -#### Special Notes +##### Special Notes -##### Use Anchors +###### Use Anchors While the bindings rely on the `click` binding so you can functionally attach them to any element you choose, if you wish to preserve ctrl+click, context menu (open in new tab/window, etc.), and other native browser UX you must still use anchor tags. The path binding will set an `href` property for these behaviors to fall back on. -##### Passing Data +###### Passing Data It may not seem immediately intuitive, but the state binding can be quite handy for passing data around in apps without a full blown model/collection layer. Imagine the following situation. @@ -68,7 +68,7 @@ class ViewModel { } ``` -##### Unit Testing +###### Unit Testing The bindings expect to find a `$router` object containing the router on the binding context and will throw an error if it is not found. diff --git a/docs/config.md b/docs/config.md index e82d9f9..3c8a1bd 100644 --- a/docs/config.md +++ b/docs/config.md @@ -2,7 +2,7 @@ These are the options available to pass to the `` component -## routes +#### routes `routes` is an object where the keys are [express style](https://github.com/pillarjs/path-to-regexp) routes and values are the array `[...callbacks, 'component-name']` or just `component-name` for shorthand. `...callbacks` are @@ -54,14 +54,14 @@ function getComponent(ctx) { } ``` -## base +#### base The base path your app is running under, if applicable. e.g., your app is running from a \`/blog\` directory __This option is only applicable to the top-level router__ -## hashbang +#### hashbang Whether or not to use HTML4 hashbang routing. Defaults to false. @@ -75,22 +75,22 @@ with the following one-liner. __This option is only applicable to the top-level router__ -## persistQuery +#### persistQuery Whether or not to preserve the querystring when navigating between pages. Defaults to false. Note, when the router is unmounted the queries will be disposed. -## persistState +#### persistState Whether or not to preserve the querystring when navigating between pages. defaults to false. Note, when the router is unmounted the states will be disposed. -## inTransition: (el, fromCtx, toCtx) => {} +#### inTransition: (el, fromCtx, toCtx) => {} Defines a function to run immediately after mounting a component -## outTransition: (el, fromCtx, toCtx[, done]) => {} +#### outTransition: (el, fromCtx, toCtx[, done]) => {} Defines a function to run immediately before unmounting a component diff --git a/docs/context.md b/docs/context.md index 3121c1a..6981bb8 100644 --- a/docs/context.md +++ b/docs/context.md @@ -3,7 +3,7 @@ This is the object passed as the first argument into routed components and available in the views as `$router`. -## params, read-only +#### params, read-only Params parsed from the route. @@ -23,40 +23,40 @@ class ViewModel { } ``` -## query, read/write +#### query, read/write -#### get(parameterName[, defaultValue, parser]) +###### get(parameterName[, defaultValue, parser]) Accessor for read/write querystring observables -#### getAll(asObservable = false) +###### getAll(asObservable = false) Gets all the query string params for this context -#### setDefaults(params[, parser]) +###### setDefaults(params[, parser]) Sets the default values for a batch of params -#### update(params) +###### update(params) Batch updates query string params -#### clear +###### clear Resets the params to their default values -## state, read/write +#### state, read/write Read/write, scoped `history.state` observable -## route, read-only -## path, read-only -## pathname, read-only -## canonicalPath, read-only -## hash, read-only -## isNavigating, read-only +#### route, read-only +#### path, read-only +#### pathname, read-only +#### canonicalPath, read-only +#### hash, read-only +#### isNavigating, read-only -## update([url, state, push = true, query]) => Promise +#### update([url, state, push = true, query]) => Promise\ Updates the context and trigger one update; bubbles up to parent router(s) if matching route is not found. @@ -64,7 +64,7 @@ if matching route is not found. Returns `false` if no route is matched, otherwise a promise that resolves the boolean `didUpdate` is returned. -## addBeforeNavigateCallback([done]) => Promise | done([shouldNavigate = true]) +#### addBeforeNavigateCallback([done]) => Promise\ | done([shouldNavigate = true]) Adds function to be called before navigating away from the current page. To perform async actions before unmounting, you may use the optional done callback or return a promise. @@ -74,10 +74,10 @@ with the first argument `false`, navigation will be prevented. You can use this function to confirm navigation away, show unsaved change warnings, perform async cleanup, etc. -## $parent +#### $parent Parent router ctx accessor -## $child +#### $child Child router ctx accessor