Some ideas about app-route element

28 views
Skip to first unread message

Alexander Rotnov

unread,
Oct 16, 2016, 2:14:12 PM10/16/16
to Polymer
For now, app-route element use "pattern" property to match route path and produce "data" object, that could be used for navigation. So, maybe its better to use data binding directly in pattern? Somehow like this:

<app-location route="{{route}}"></app-location>
<app-route
        route="{{route}}"
        pattern="/elements/{{element}}">
</app-route>

So, I can define property "element" in my component:

properties: {
        element: {
          type: String,
          notify: true
        }
}

and use it in iron-selector or iron-pages:
<iron-selector selected="{{element}}" attr-for-selected="id">
  <a id="app-route" href="/app-route">
  <!-- other links-->
</iron-selector>sript 

<iron-pages selected="{{element}}" attr-for-selected="id">
  <element-description id="app-route">
  <!-- other elements -->
</iron-pages>

And finally, upward binding for "element" property causes app-route to change "route" object, that cause app-location to change browser location. So, we dont need any scripted handlers :)
Reply all
Reply to author
Forward
0 new messages