0

I have a case where I allow the user to enter information in a form and then after they submit it they should get redirected back to the same form in a read-only view. I can see that the onSubmit is called the first time the user goes to the form, date is saved, and the code for the redirect is called (the URL also changes) but the form never shows the read-only view. Do I have to destroy the component first and then redirect (not sure how to destroy the component actually) or is there a better way?

1
  • 1
    I am able to get this working by redirecting to another component which then redirects me back to the one I want but that seems more like a kludge than a fix Commented Feb 28, 2017 at 15:11

1 Answer 1

1

I have same question with you, but I have solved it. It's my understanding, when we use router, angular2 will check the router path, when we router to same page, the router path has no change, the module data changed. The page only changes the module data, but never refreshes the page. So, we have two method to solve it.

  1. Use different router path name direct to same router module;
  2. Clear all parameter when we get router parameters.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.