Armita Armita - 6 months ago 230
AngularJS Question

ui-select with error loading "Module 'ui.select' is not available! You either misspelled the module name or forgot to load it."

I tried to use ui-select directive in my solution. I added the whole Github folder about ui-select in my solution. I also inject the 'ui.select' in my app.js. But when I run the solution, the following error is shown in the F12:

Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to:
Error: [$injector:modulerr] Failed to instantiate module MetronicApp due to:
Error: [$injector:modulerr] Failed to instantiate module oc.lazyLoad due to:
Error: [$injector:nomod] Module 'ui.select' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

Answer

Include the downloaded file path properly using script tags in your main index.html file and make sure that you injected the dependency properly as follow in your app.js file:

angular.module('myModule', ['ui.select']);

(or)

Other way is to use package managers:

You can use npm or bower installs

npm install ui-select

bower install angular-ui-select

and make sure that you injected the dependency properly

angular.module('myModule', ['ui.select']);
Comments