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

on-step-change callback method ussage #49

Closed rdzidziguri closed 7 years ago

rdzidziguri commented 8 years ago

on-step-change="vm.onStepChange()" this is my of form and in a parent controller i get this method invoked whenever step changes, but the problem is that it does not take any parameters and in a parent controller (view of this controller includes directive for multi step form). there is not way to learn on which step form is currently on. is there any way i can access this information in the parent controller? maybe method could take argument which includes curent step next step and previews step as a argument object values?

rdzidziguri commented 8 years ago

Creating property inside vm would be another option but in this case each step has to implement logic to set value for this step. this would work but architecturally this is not the right way do achieve what i want so is there any better way we could achieve this?

rdzidziguri commented 8 years ago

possible place to edit

I think all is needed to achieve this is to pass this function step item.

newStepElement.then(function (step) {
                                onStepChange(step);
                                currentStepScope = step.scope;
                                currentStepElement = step.element;
                                currentStepElement.scrollTop = 0;
                                stepContainer.scrollTop = 0;
                                currentEnterAnimation = $animate.enter(currentStepElement, stepContainer);
                            }, function () {
                                throw new Error('Could not load step ' + step);
});