Javascript – Microsoft Jscript Angular is undefined

angularjsasp.net-mvcjavascriptnetvisual studio

As I'm trying to put some angular in my .net mvc website, I encounter the following error at runtime

0x800a1391 – Erreur d'exécution Microsoft JScript: 'angular' est
indéfini.

Which means: Error at Microsoft Jscript runtime: 'angular' is undefined .

This occurs for the following code

var customersApp = angular.module('propositionApp', ['ngGrid']);

Some research on the internet advise to add the following code in the head tag (i use angular 1.2.23)

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

But this generates even more runtime errors because some part of the code returned by the url are Null.

Of course, I've added angular to my project with nugget package.

Where does this problem "angular" is not defined?

Best Answer

It looks like you are not requiring the general angular library. Add

<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>

in the head of your document before your javascript files.