I am using polymers for an app and using Eric Ringmouth for routing. The code is as follows:
index.html:
& lt; App Router Mode = "PustState" & gt; & Lt; Ap-root path = "/" import = "/ element / login-page / login-page html" & gt; & Lt; / App-path & gt; & Lt; Ap-root path = "/ dash" import = "/ element / dash-page / dash-page html" & gt; & Lt; / App-path & gt; & Lt; Ap-root path = "/ new" import = "/ element / new-page / new-page-page" & gt; & Lt; / App-path & gt; & Lt; Ap-root path = "*" import = "/ elements / dash-page / dash-page html" & gt; & Lt; / App-path & gt; & Lt; / Application router & gt;
In the login page:
& lt; Link rel = "import" href = "../../../ bower_components / polymer / polymer.html" & gt; & Lt; Polymer-element name = "login-page" attributes = "" & gt; & Lt; Templates & gt; & Lt; Link rel = "stylesheet" href = "login-page.css" & gt; & Lt; Section vertical layout center-center & gt; & Lt; H1 & gt; Login with: & lt; / H1> & Lt; Fire-login provider = "Gitb" & gt; & Lt; / Fire-login & gt; & Lt; Fire-login provider = "Facebook" & gt; & Lt; / Fire-login & gt; & Lt; / Section & gt; & Lt; / Template & gt; & Lt; / Polymer element & gt;
The other pages are the same. Everything works fine outside the box, but when I refresh any page, I can not get a GET / dash
or GET / new
. Going back to the original path and refreshing, everything goes again.
I do not understand why refresh does not work.
You are expecting more magic than this component, which can provide :)
The requests are going to the HTTP server, directly using the & lt; app-router & gt;
component you are using the HTML5 PushState
route She said, when you specify / new
as a new route, then the component shows the desired import and location.href
with the http : // changes youserver / new
On the other hand, when you http: // youserver / new
. Looks like different functions, okay ?
Then, http: // youserver / new
is being requested by your web server and as such there is no such page, so you have to 404
.
You have two options:
- To handle
/ new
, enter your http server atYour_router_page.html
with mod_rewrite
or like; -
& lt; App-root & gt; Specify the appropriate path in
s.
The component-path (IMHO) is to specify the appropriate path:
app-root path = "/ my-router.html? / Dash "& gt; & Lt; / App Path & gt;
Or they get stuck for navigation like a better hash, because it works outside of the box and does not need to deal with any specific route. PushState
The current component is more like handling redirects than handling.
Hope it helps.
No comments:
Post a Comment