0

I followed the tutorial to build the multiple step form using UI Router , it worked well, however now I would like to prevent from page reloading action, if user stays at 2nd step, and reload whole page, it should be redirected to first step, and required him to input to first step form first.

I have no idea to reload the page to the first step with that requirement

2 Answers 2

1

You can check the status with a flag in your first step.

Sign up to request clarification or add additional context in comments.

Comments

0

You could simply look at the current state and do basic validation on the data object. If the values are empty then force the state back to the first state.

 if($state.current.name != "form.profile" && (!$scope.name || !$scope.email)){
  $state.go("form.profile");
}

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.