How to inject this dependency in angularjs?

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

Upvotes: 0

Views: 256

Answers (1)

Phix
Phix

Reputation: 9890

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>

Upvotes: 1

Related Questions