0

I am having diffculty injecting this dependency: https://cdnjs.cloudflare.com/ajax/libs/angularjs-dropdown-multiselect/2.0.0-beta.10/src/angularjs-dropdown-multiselect.js into my project.

Here is the dependency injection scheme used in the project:

 angular.module("myModule").controller("myController", MyController);

    function MyController($scope, $window, angular-js-dropdown-multiselect ){
    
    }
     MyController.$inject = ["$scope", "$window", "angular-js-dropdown-multiselect"]

However angular throws a Error: $injector:unpr Unknown Provider error.

I've tried changing angular-js-dropdown-multiselect to angularJsDropdownMultiselect but still see the error.

Any suggestions?

Thanks, Matt

3
  • It all starts with angular-js-dropdownMultiselect being a syntax error Commented Dec 27, 2017 at 19:52
  • Respect JS sintax. Commented Dec 27, 2017 at 19:55
  • fixed the typo on my part. Still have the problem. Thanks! Commented Dec 27, 2017 at 20:05

1 Answer 1

1

You're trying to inject a module as opposed to a provider. Include that script on your page and inject whatever providers that module exposes.

Looking at that file, it doesn't expose anything but a directive, so just do something like the following:

JS:

angular.module('yourMoudule', ['angularjs-dropdown-multiselect'])

Usage:

<div dm-dropdown-static-include>...</div>
Sign up to request clarification or add additional context in comments.

1 Comment

Took me awhile to figure out I needed to make your change at the top level of the application - not the controller...Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.