multiStepFormInstance is not getting injected into controller
See original GitHub issuevar store_module = angular.module('store', [
'app.config',
'flash',
'multiStepForm'
]);
store_module.controller('myStore', ['$scope','multiStepFormInstance', function($scope, multiStepFormInstance){
$scope.addStore = function() {
console.log('hello world');
console.log(multiStepFormInstance.getActiveIndex());
}
}]);
I have a multi step form, in the first step I am asking some user input and before moving to next step I want to do some action with user provided input, first step has ‘add store’ button on it’s click I am calling the addStore function, here inside this function I want to move user to next step only if store gets added. For this I require multiStepFormInstance with which help I can set activeindex as the desired step index. However I keep getting following error :
error: [$injector:unpr] Unknown provider: multiStepFormInstanceProvider <- multiStepFormInstance <- myStore
what’s the correct way to inject multiStepFormInstance into the controller, am I missing something here? Is is possible to change step from controller method ?
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Error injecting dependency into Controller constructor
I can't figure out what is causing the error for one dependency and not the other. The two follow the same pattern, just...
Read more >Dependency injection into controllers in ASP.NET Core
Discover how ASP.NET Core MVC controllers request their dependencies explicitly via their constructors with dependency injection in ASP.
Read more >Understanding Dependency Injection in .NET Core - Auth0
This tutorial will try to clarify the various Dependency Injection concepts ... The following example shows how you can get this in a...
Read more >Developer Guide: Dependency Injection - AngularJS: API
The simplest way to get hold of the dependencies is to assume that the function parameter names are the names of the dependencies....
Read more >Service Container - The PHP Framework For Web Artisans
So, we will inject a service that is able to retrieve users. ... (not interfaces), the container does not need to be instructed...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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.
Thank you so much @troch ,
stepCtrl was getting instantiated from ng-controller directive in my HTML, I removed that it is working fine.
Again thanks a lot 👍