Reputation: 71
I want to implement the login function which the current component can be navigated to another component after clicking the login button.
My .ts and .html files are shown as follows
The question is : when I use npm start to monitor the change, expiryPage(which is the target I want to redirect to ) since to be loaded twice.
The first time the component is loaded, the url looks like
http://localhost:3000/expiryPage?
and then the page will refresh soon that the url will be fixed, like
http://localhost:3000/expiryPage
It seems to work when using npm, but when I use a google chrome application "Web Server" to run the web, it gives me a entry not found
on the page and the error messenge Failed to load resource: the server responded with a status of 404 (Not Found)
Is there any idea about this question? I have searched the solution for couple hours
Thanks a lot
Upvotes: 0
Views: 925
Reputation: 71
I finally find the answer from Angular2 router.navigate refresh page
Hope it helps who is in cart
Upvotes: 1