| 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 <link rel="import" href="../iron-location/iron-location.html"> | |
| 11 <link rel="import" href="../iron-location/iron-query-params.html"> | |
| 12 <link rel="import" href="carbon-route-converter.html"> | |
| 13 | |
| 14 <!-- | |
| 15 `carbon-location` is an element that provides synchronization between the | |
| 16 browser location bar and the state of an app. When created, `carbon-location` | |
| 17 elements will automatically watch the global location for changes. As changes | |
| 18 occur, `carbon-location` produces and updates an object called `route`. This | |
| 19 `route` object is suitable for passing into a `carbon-route`, and other similar | |
| 20 elements. | |
| 21 | |
| 22 An example of a route object that describes the URL | |
| 23 `https://elements.polymer-project.org/elements/carbon-route-converter?foo=bar&ba
z=qux`: | |
| 24 | |
| 25 { | |
| 26 prefix: '', | |
| 27 path: '/elements/carbon-route-converter' | |
| 28 } | |
| 29 | |
| 30 Example Usage: | |
| 31 | |
| 32 <carbon-location route="{{route}}"></carbon-location> | |
| 33 <carbon-route route="{{route}}" pattern="/:page" data="{{data}}"></carbon-ro
ute> | |
| 34 | |
| 35 As you can see above, the `carbon-location` element produces a `route` and that | |
| 36 property is then bound into the `carbon-route` element. The bindings are two- | |
| 37 directional, so when changes to the `route` object occur within `carbon-route`, | |
| 38 they automatically reflect back to the global location. | |
| 39 | |
| 40 A `carbon-location` can be configured to use the hash part of a URL as the | |
| 41 canonical source for path information. | |
| 42 | |
| 43 Example: | |
| 44 | |
| 45 <carbon-location route="{{route}}" use-hash-as-path></carbon-location> | |
| 46 | |
| 47 @element carbon-location | |
| 48 @demo demo/index.html | |
| 49 --> | |
| 50 | |
| 51 </head><body><dom-module id="carbon-location"> | |
| 52 <template> | |
| 53 <iron-location path="{{__path}}" query="{{__query}}" hash="{{__hash}}" url-s
pace-regex="{{urlSpaceRegex}}"> | |
| 54 </iron-location> | |
| 55 <iron-query-params params-string="{{__query}}" params-object="{{__queryParam
s}}"> | |
| 56 </iron-query-params> | |
| 57 <carbon-route-converter on-path-changed="__onPathChanged" path="[[__computeR
outePath(__path, __hash, useHashAsPath)]]" query-params="{{__queryParams}}" rout
e="{{route}}"> | |
| 58 </carbon-route-converter> | |
| 59 </template> | |
| 60 </dom-module> | |
| 61 <script src="carbon-location-extracted.js"></script></body></html> | |
| OLD | NEW |