Comments (6)
Here is the relevant code snippets:
.controller('MyCtrl', function ($scope, $state, AuthService, $multiStepForm) {
$scope.reset = function() {
$scope.model = {};
}
$scope.logout = function () {
$multiStepFormInstance.setActiveIndex(1);
AuthService.logout();
$state.go('login');
};
....
})
<ion-view view-title="StepsTab" name="step-tabs-view">
<ion-nav-buttons side="right">
<button class="button icon ion-log-out button-stable" ng-click="logout()"></button>
</ion-nav-buttons>
<ion-content class="padding">
<multi-step-container steps="steps">
<header>
<div id="status-buttons" class="text-center">
<a ng-class="$getActiveStep().title == 'Step1' ? 'active' : ''"><span>1</span> Step 1</a>
<a ng-class="$getActiveStep().title == 'Step2' ? 'active' : ''"><span>2</span> Step 2</a>
<a ng-class="$getActiveStep().title == 'Step3' ? 'active' : ''"><span>3</span> Step 3</a>
</div>
<div class="stepHeading">
{{$getActiveStep().title}}
</div>
<div style="{{$isLast() ? 'display: none' : ''}}">
<br>
<button ng-disabled="$isFirst()" class="button button-small button-stable ion-chevron-left" ng-click="$previousStep()">
Previous
</button>
<button ng-disabled="$isLast() || ($getActiveStep().hasForm && !$getActiveStep().valid)" class="button button-small button-stable icon-right ion-chevron-right" ng-click="$nextStep()">Next
</button>
</div>
<div style="{{$isLast() ? '' : 'display: none'}}">
<br>
<button class="button button-small button-stable" ng-click="reset(); $setActiveIndex(1)">Done
</button>
</div>
</header>
<br>
<main step-container></main>
</multi-step-container>
</ion-content>
</ion-view>
from angular-multi-step-form.
Hi @thirionjwf,
You are not doing anything wrong. You cannot inject multiStepInstance
outside the directive because it is not available application wide (it is specific to that instance).
Currently it is not possible to control a multiStepForm instance from outside the directive. I can work on a solution, however from an application perspective I would encourage you to destroy the multiStepForm instance and create a new one rather than trying to go back to step 1 (which is not a proper "reset").
You can simply destroy the directive by forcing a reload of your view. That would reset the multi-step form.
from angular-multi-step-form.
Thank you. I assume you refer to something like:
$scope.reloadRoute = function() {
$route.reload();
}
which will reload the current route. Or would the form instance only get destroyed on a full refresh, i.e.:
$scope.reloadRoute = function() {
$window.location.reload();
}
Great plugin. Works very well.
from angular-multi-step-form.
A route reload will be enough, no need to refresh / reload the page. Not sure how do to so with <ion-view/>
. It might involve $route
if based on ngRoute or $state
if based on ui-router
.
from angular-multi-step-form.
Thanks. Much appreciated. You can close the "issue".
from angular-multi-step-form.
👍
from angular-multi-step-form.
Related Issues (20)
- Can it support check required fields on each step form HOT 2
- may we have to add setStep function HOT 1
- Dynamic Add Step HOT 4
- Is there any demo? HOT 3
- Dynamically appending steps on form element click HOT 1
- Angular Can't inject multiStepFormInstance HOT 4
- On Next button click validate the form HOT 3
- Please share code of examples? HOT 2
- Multi-step form with status wizard HOT 1
- How can we inject new services to multiStepFormModule ?
- How to post data or call rest service by clicking the button on last step in multistep form?
- How to inject nextStep programatically? HOT 1
- TypeScript Support HOT 1
- Is it possible to save data with a searchId ?
- Setting default 'valid' value for Step
- scope variables not available in step
- Is it possible to navigate to another step apart from Step1, when html Link is provided for multi-step-form? HOT 1
- Question: Can it be used with angular 4 ? HOT 1
- angular 4 and bootstrap 3.7 + HOT 4
- Examples are not accessible HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-multi-step-form.