erikringsmuth/app-router

Feature: Provide output as alternative to using loader

Open

#70 opened on Jan 29, 2015

View on GitHub
 (2 comments) (0 reactions) (0 assignees)HTML (608 stars) (83 forks)batch import
enhancementhelp wanted

Description

Was tinkering and came up with an interesting use case to throw out there. It would be interesting if, instead of loading elements or templates, a matching route could simply output its value. Code example:

<app-route
   path="/line/:lineId/load"
   output="{{output}}"></app-route>
// where output would look like:
{
    lineId: '<line_id>'
}

another with a little more complexity:

<app-route
   path="/foo/:foo/bar/:bar/baz/:shizzle"
   output="{{output}}"></app-route>
// where output would look like:
{
    foo: '<foo>',
    bar: '<bar>',
    shizzle: '<shizzle>',
}

What would be interesting here is that the user could implement whatever mechanism desired for generating UI. The <flatiron-director></flatiron-director> examples tend to go this route, passing the path out of flatiron, but not having the benefits of matching variables. They are always very simple from what I've seen.

So being able to do this:

  Polymer({
     outputChanged: function(oldVal, newVal) {
       // oldVal = the previous path match representation
       // newVal = the new match
       // I can map the route however I desire, binding to any number of 
       // other components...
       this.foo = newVal.foo; 
       this.bar = newVal.bar;
     }
  })

Its an interesting idea.

Contributor guide