angular2-wizard icon indicating copy to clipboard operation
angular2-wizard copied to clipboard

How to handle error case on Done?

Open jaymojnidar opened this issue 8 years ago • 4 comments

Great work!

I am running an issue with user clicking on the Done button. In my case, when the user clicks on Done, I run a http post in my onComplete function. If there is an error, I set isCompleted to false in my code. So, that I can continue to display the form for user to correct. But, the Prev, Next, and Done buttons are not displayed.

Thank you for your help!

jaymojnidar avatar Mar 06 '17 06:03 jaymojnidar

Nice catch. I overlook this scenario. The current behavior right now will hide all navigation buttons after user click done. The isCompleted property cannot be set from outside the component.

I will make changes to allow managing the isCompleted property. It will not hide all the buttons by default.

maiyaporn avatar Mar 07 '17 00:03 maiyaporn

Eagerly waiting for this update. Great work !

sree-mohan avatar Mar 23 '17 06:03 sree-mohan

There are a few issues that I need to figure out to implement this. I was a bit busy these last two weeks, so I haven't started anything. I will try to do this asap. If anyone has any suggestion how to get this done, feel free to let me know. PR is also welcome.

maiyaporn avatar Apr 04 '17 03:04 maiyaporn

I submitted a pull request for this issue. I added a method to handle server errors after the user submits. To invoke it you just need to add "forceStep = 1" to the error handler portion of your post method or replace 1 with whichever step you want to revert the user too. the method also sets isCompleted back to false so that the buttons return. I have this implemented on my app and I display the server error on the corresponding input field and then revert the user to that step. Hope this works for you guys, let me know if you have any suggestions for improvement or questions about the implementation.

micahcourey avatar Jul 14 '17 04:07 micahcourey