Skip to content

Commit

Permalink
Adding docs about href with params
Browse files Browse the repository at this point in the history
  • Loading branch information
finnsson committed Feb 20, 2013
1 parent 586888e commit a32703b
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions pagerjs.com/demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
<div data-bind="page: {id: 'deep_navigation', title: 'Deep Navigation', desc: 'navigating into subpages of subpages', scrollToTop: true, sourceCache: true, sourceOnShow: 'page/deep_navigation.html'}"></div>
<div data-bind="page: {id: 'relative_path', title: 'Relative Path', desc: 'traversing the fragment identifier', scrollToTop: true, sourceCache: true, sourceOnShow: 'page/relative_path.html'}"></div>
<div data-bind="page: {id: 'absolute_path', title: 'Absolute Path', sourceOnShow: 'page/absolute_path.html', scrollToTop: true, sourceCache: true, desc: 'binding page-href to page-instance'}"></div>
<div data-bind="page: {id: 'href_with_params', title: 'Parameters in Path', sourceOnShow: 'page/href_with_params.html', scrollToTop: true, sourceCache: true, desc: 'add parameters to page-href'}"></div>
<div data-bind="page: {id: 'html5_history', title: 'HTML5 History', desc: 'you do not need to use fragment identifiers', scrollToTop: true, sourceCache: true, sourceOnShow: 'page/html5_history.html'}"></div>
<div data-bind="page: {id: 'matching_wildcards', title: 'Matching Wildcards', desc: 'pages that match any route', scrollToTop: true, sourceCache: true, sourceOnShow: 'page/matching_wildcards.html'}"></div>

Expand Down
41 changes: 41 additions & 0 deletions pagerjs.com/demo/page/href_with_params.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<header class="jumbotron subhead">
<h1>Parameters in Path</h1>

<p class="lead">
You can supply the <code>page-href</code> binding with not only a path
but also parameters. This is done using the syntax <code>page-href: {path:,params:}</code>
where path can be a <code>String</code> or <code>Page</code> as normal and
params can be an object.
</p>
</header>

<a class="btn" data-bind="page-href: {path: 'user', params: {first: 'Philip', last: 'Fry'}}">Send parameter to page</a>

<div data-bind="page: {id: 'user', params: ['first','last']}" class="well-small">
<div>
<span>First name:</span>
<span data-bind="text: first"></span>
</div>
<div>
<span>Last name:</span>
<span data-bind="text: last"></span>
</div>
</div>


<pre data-bind="prettyprint: {}" class="prettyprint linenums">
&lt;a class="btn" data-bind="page-href: {path: 'user', params: {first: 'Philip', last: 'Fry'}}"&gt;Send parameter to page&lt;/a&gt;

&lt;div data-bind="page: {id: 'user', params: ['first','last']}" class="well-small"&gt;
&lt;div&gt;
&lt;span&gt;First name:&lt;/span&gt;
&lt;span data-bind="text: first"&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span&gt;Last name:&lt;/span&gt;
&lt;span data-bind="text: last"&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;/div&gt;
</pre>

<div data-bind="template: {name: 'link-template'}"></div>

0 comments on commit a32703b

Please sign in to comment.