| OLD | NEW |
| (Empty) | |
| 1 <!-- |
| 2 @license |
| 3 Copyright (c) 2016 The Polymer Project Authors. All rights reserved. |
| 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 7 Code distributed by Google as part of the polymer project is also |
| 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 9 --><html><head><link rel="import" href="../polymer/polymer.html"> |
| 10 |
| 11 <!-- |
| 12 `carbon-route-converter` provides a means to convert a path and query |
| 13 parameters into a route object and vice versa. This produced route object |
| 14 is to be fed into route-consuming elements such as `carbon-route`. |
| 15 |
| 16 > n.b. This element is intended to be a primitive of the routing system and for |
| 17 creating bespoke routing solutions from scratch. To simply include routing in |
| 18 an app, please refer to [carbon-location](https://github.com/PolymerElements/car
bon-route/blob/master/carbon-location.html) |
| 19 and [carbon-route](https://github.com/PolymerElements/carbon-route/blob/master/c
arbon-route.html). |
| 20 |
| 21 An example of a route element that describes |
| 22 `https://elements.polymer-project.org/elements/carbon-route-converter?foo=bar&ba
z=qux`: |
| 23 |
| 24 { |
| 25 prefix: '', |
| 26 path: '/elements/carbon-route-converter', |
| 27 queryParams: { |
| 28 foo: 'bar', |
| 29 baz: 'qux' |
| 30 } |
| 31 } |
| 32 |
| 33 Example Usage: |
| 34 |
| 35 <iron-location path="{{path}}" query="{{query}}"></iron-location> |
| 36 <iron-query-params |
| 37 params-string="{{query}}" |
| 38 params-object="{{queryParams}}"> |
| 39 </iron-query-params> |
| 40 <carbon-route-converter |
| 41 path="{{path}}" |
| 42 query-params="{{queryParams}}" |
| 43 route="{{route}}"> |
| 44 </carbon-route-converter> |
| 45 <carbon-route route='{{route}}' pattern='/:page' data='{{data}}'> |
| 46 </carbon-route> |
| 47 |
| 48 This is a simplified implementation of the `carbon-location` element. Here the |
| 49 `iron-location` produces a path and a query, the `iron-query-params` consumes |
| 50 the query and produces a queryParams object, and the `carbon-route-converter` |
| 51 consumes the path and the query params and converts it into a route which is in |
| 52 turn is consumed by the `carbon-route`. |
| 53 |
| 54 @element carbon-route-converter |
| 55 @demo demo/index.html |
| 56 --> |
| 57 |
| 58 </head><body><script src="carbon-route-converter-extracted.js"></script></body><
/html> |
| OLD | NEW |