javascript - Why are these Polymer routes not working when called from outside of the application? -
i using polymer starter kit 1.0.1 simple application. have in routing.html
:
<script> window.addeventlistener('webcomponentsready', function() { page('/users/:name', function (data) { app.route = 'user-info'; app.params = data.params; }); //other routes... page({ hashbang: false }); });
i have index.html file this:
<iron-pages attr-for-selected="data-route" selected="{{route}}"> <section data-route="user-info"> <paper-material elevation="1"> <h2 class="paper-font-display2"> user:<span>{{params.name}}</span> </h2> <div>this <span>{{params.name}}</span>'s section</div> </paper-material> </section> </iron-pages>
when have link within application pointing route this:
<a href="/users/john"></a>
the page loads , url in address bar http://localhost:3000/users/john
. when enter same address directly in url , reload page, get
`cannot /users/john`
how can avoid error , have same behavior when link clicked within application.
because when directly hit path localhost:3000/users/john
index.html file not loaded... can give 2 nice options solve problem
- use
hashbang: true
on page.js - use element routing, still under development, pretty neat easy-router
Comments
Post a Comment