SwimmingG SwimmingG - 3 months ago 32
HTML Question

Ui-router, unknown provider issue

I get the following error "Module 'ui-router' 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."

enter image description here

What is weird is that I have installed ui-router using npm install and it is in my packages.json file.

I presume the error is because I have misspelled the module name?

Any help is really appreciated,

Thanks.

Answer

As the error states you either misspelled the module name or forgot to load it. In this case you misspelled it, it should be ui.router not ui-router.

var app = angular.module('myApp', ['ui.router']);

The only other cause of this error, after spelling it correctly, would be that you forgot to load it. Fix this by including a reference to the library.