Comments (8)
I don't have a live example, but just injected it here: http://blog.reactandbethankful.com/angular-multi-step-form/#/saving-data (https://github.com/troch/troch.github.io/blob/master/angular-multi-step-form/scripts/app.js#L143).
Are you certain you don't use 'stepCtrl' anywhere else in your app? The error you see is typical of the controller being instantiated outside the directive.
from angular-multi-step-form.
Hi @troch
Is it possible to change step from controller method ?
from angular-multi-step-form.
A controller will only receive multiStepFormInstance
if it is used by a <multi-step-container steps="..."></multi-step-container>
. So you need to configure your steps with your controller on one of the steps, and let the directive instantiate them (it will provide them the multiStepFormInstance).
Is it possible to change step from controller method ?
I am not sure to understand your question.
from angular-multi-step-form.
Hi @troch
Here is my code, not sure what I am missing here
my store.html file is as follows in this file I am loading the steps by using the <multi-step-container>
directive
<div class="wrapper-section">
<div class="container" ng-controller="homeCtrl">
<multi-step-container steps="storeSteps" on-cancel="$dismiss()" on-finish="$close()" search-id="'step'">
<main step-container>
</main>
</multi-step-container>
</div>
</div>
Here is my app.js file inside which I have defined homeCtrl like this:
app.controller('homeCtrl',['$scope', '$http', function($scope, $http) {
$scope.storeSteps = [
{
templateUrl: '/app/modules/common-views/store/launch-setup.html',
hasForm: true,
controller: 'homeCtrl'
},
{
templateUrl: '/app/modules/common-views/store/step-one.html',
hasForm: true
},
{
templateUrl: '/app/modules/common-views/store/step-two.html',
},
{
templateUrl: '/app/modules/common-views/store/step-three.html',
},
{
templateUrl: '/app/modules/common-views/store/finish.html',
}
];
$scope.addStore = function() {
console.log('hello world');
multiStepFormInstance.setActiveIndex(2);
//console.log(multiStepFormInstance.getActiveIndex());
}
}]);
Is it possible to change step from controller method ?
By this I mean on my first step (i.e. launch-setup.html) there is 'Add' button on click of which I will add a record and want to navigate to next step if the record is successfully added, if not, then show the error message. For this I have written addStore() method inside the controller.
I want to know is it possible to render step 2 from this addStore method defined in controller?
from angular-multi-step-form.
Your code won't work, I am not sure what you want to do. But 'homeCtrl' cannot be a form step controller as well as the controller defining your steps. So you need two different controllers.
app.controller('stepCtrl', ['$scope', 'multiStepFormInstance', function ($scope, multiStepFormInstance) {
$scope.addStore = function() {
console.log('hello world');
multiStepFormInstance.setActiveIndex(2);
//console.log(multiStepFormInstance.getActiveIndex());
};
});
app.controller('homeCtrl',['$scope', '$http', function($scope, $http) {
$scope.storeSteps = [
{
templateUrl: '/app/modules/common-views/store/launch-setup.html',
hasForm: true,
controller: 'stepCtrl'
},
{
templateUrl: '/app/modules/common-views/store/step-one.html',
hasForm: true
},
{
templateUrl: '/app/modules/common-views/store/step-two.html',
},
{
templateUrl: '/app/modules/common-views/store/step-three.html',
},
{
templateUrl: '/app/modules/common-views/store/finish.html',
}
];
}
}]);
from angular-multi-step-form.
Hi @troch ,
I created separate controllers as you mentioned in above comment, I am still the getting the same errror
Error: [$injector:unpr] Unknown provider: multiStepFormInstanceProvider <- multiStepFormInstance <- stepCtrl
http://errors.angularjs.org/1.4.5/$injector/unpr?p0=multiStepFormInstanceProvider%20%3C-%20multiStepFormInstance%20%3C-%20stepCtrl
from angular-multi-step-form.
Hi @troch ,
Do you have a sample example of injecting 'multiStepFormInstance' into controller? may be, I could refer that to see it in action and figure out what I am missing here
from angular-multi-step-form.
Thank you so much @troch ,
Are you certain you don't use 'stepCtrl' anywhere else in your app? The error you see is typical of the controller being instantiated outside the directive.
stepCtrl was getting instantiated from ng-controller directive in my HTML, I removed that it is working fine.
Again thanks a lot 👍
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.