Uncaught Error: [$injector:modulerr] and ngRoute Error in Angular JS

155 Views Asked by At

I am having a problem with a controller that doesn't connect with the server. I solved alot of errors but still I get this error:

Uncaught Error: [$injector:modulerr]

I searched and I found out that I need to use ngRoute. I used the CDN in the html file

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.7.9/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.7.9/angular-route.min.js"></script>

and in the controller JS file:

var courseApp = angular.module('courseApp', ['ui.bootstrap', 'seeMoreFilter', 'ngSanitize', 'ngRoute']);

but still it gaveme the same error

I installed it with npm

npm install --save [email protected]

I got another error in addition to the first one:

angular-route.js:102 Uncaught TypeError: b.module(...).info is not a function

1

There are 1 best solutions below

0
J. B On

This error usually happens when you are trying to inject a module that is not available whe the apps loads. Based on the code that you posted I would check this modules 'ui.bootstrap', 'seeMoreFilter', 'ngSanitize' because I don't see where are you loading this modules.

Happy coding and stay safe!!!