0
votes

Ok so example we have a polymer-starter-kit with user section

routing.html is :

 page('/users', function() {
      app.route = 'users';
    });

    page('/users/:name', function(data) {
      app.route = 'user-info';
      app.params = data.params;
    });
offcourse we have section for this :

 <section data-route="users">
              <paper-material elevation="1">
                <h2 class="page-title">Users</h2>
                <p>This is the users section</p>
                <a href$="{{baseUrl}}users/Addy">Addy</a><br>
                <a href$="{{baseUrl}}users/Rob">Rob</a><br>
                <a href$="{{baseUrl}}users/Chuck">Chuck</a><br>
                <a href$="{{baseUrl}}users/Sam">Sam</a>
              </paper-material>
            </section>

And when we click on any of a href above we will se what we need url will be http://localhost:5000/#!/users/Chuck but whenever i will change name in url and press ENTER i will go an ERROR(404 and redirect) But if i just copy and put the url with random username to a new tab everithing will work fine. So the question is how to handle changing the url as a parameter

Question number 2 if i run from javascript app.route='users/Rob' nothing changes app.route="home" or app.route="users" works fine. So how do go to section with parameters from javascript code.

1

1 Answers

0
votes

Ok i found how to do it

app.route="user-info"
app.params={0:"/users/MyUserName",name:"MyUserName"}