question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

multiStepFormInstance is not getting injected into controller

See original GitHub issue
var 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:closed
  • Created 8 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
trochcommented, Oct 16, 2015

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.

0reactions
rahul-cuelogiccommented, Oct 16, 2015

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 👍

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found