troch / angular-multi-step-form

An angular module for creating multi step forms / wizards
http://troch.github.io/angular-multi-step-form
ISC License
144 stars 44 forks source link

Add the possibility to go back to previous step in history #36

Closed valexiev closed 8 years ago

valexiev commented 8 years ago

There are case when you want to jump over some steps. Then if want to go back, you would expect to go to the previous step in history, not the previous index.

troch commented 8 years ago

Hi @valexiev,

Thanks for creating this PR. I think this is a good feature to have. Could you change the naming of some of your variables:

- this.setActiveIndex = function (step, isBackStep) {
+ this.setActiveIndex = function (step, pushToHistory = true) {
- this.setActiveIndex = if (!isBackStep && this.activeIndex) {
+ this.setActiveIndex = if (pushToHistory && this.activeIndex) {
- this.backStep = function () {
+ this.lastVisitedStep = function () {
- this.setActiveIndex(this.history.pop(), true);
+ this.setActiveIndex(this.history.pop(), false);

The next question I would ask is: what about going forward in history? (currently it wouldn't be possible because of the use of pop)

maximepvrt commented 8 years ago

Hi, can you merge and after change the naming @troch ? I would like use this feature quickly 😄

troch commented 8 years ago

The PR is incomplete, so I'm not going to merge it. It only deals with going back in history and not going forward.

History can be used by using a searchId: https://github.com/troch/angular-multi-step-form/blob/master/docs/multi-step-container.md.