During the discussion, we discovered two possible solutions: creating a meta-element to track all route elements or a default fallback for selectors based on the route. After some thinking and prototyping, @rictic and me think that the simplest and most elegant solution is to allow a default/fallback for the selectors.
Proposal
We propose a new property defaultSelected in IronSelectableBehavior. This property is a fallback when _valueToItem results in undefined and this.attrForSelected is set. In that case, there was no match for the specific route.
Description
With the recent release of
carbon-route
, a current issue is a missing default routing fallback when for example a 404 is hit. The issue with the request of this feature: https://github.com/PolymerElements/carbon-route/issues/68During the discussion, we discovered two possible solutions: creating a meta-element to track all route elements or a default fallback for selectors based on the route. After some thinking and prototyping, @rictic and me think that the simplest and most elegant solution is to allow a default/fallback for the selectors.
Proposal
We propose a new property
defaultSelected
inIronSelectableBehavior
. This property is a fallback when_valueToItem
results in undefined andthis.attrForSelected
is set. In that case, there was no match for the specific route.Example use-case
A full use-case can be found here: https://gist.github.com/TimvdLippe/9bfebc20aec75dd36126b8162c310dff
The usage of
iron-pages
:Compatibility
The implementation of this feature should be fairly easy and backwards-compatible.
One possible implementation could be: