Click here to Skip to main content
15,896,269 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Friends,

I am new in Angularjs and try my first application to print values from javascript file. but i got the following error
Uncaught Error: [$injector:modulerr]http://errors.angularjs.org/1.4.5/$injector/modulerr?p0=gemStore&p1=Error%3…2FUsers%2Feviksan%2FDownloads%2FAngular%2520js%2Fangular.min.js%3A19%3A381)


refer the below code:

HTML
<!DOCTYPE html>
<html  ng-app="gemStore">
<head>

<script src="angular.min.js"></script>
<script type="javascript" src="app.js"></script>
</head>
<body >
<div ng-controller="StoreController as store">
 	
	{{5+6}}
</div>
</body>
</html>


and the app.js file:

JavaScript
(function(){
  var gem = { name: 'Azurite', price: 2.95 };
  var app = angular.module('gemStore', []);
  app.controller('StoreController',function(){
	this.product=gem;
	
});
})();


//BR
Vikas Sangal
Posted
Updated 17-Sep-15 22:19pm
v2

1 solution

Firstly, you need to mention the version of angular js you have referred. If it is before 1.2.0 then you need to include ngRoute module for the routing reference. Otherwise not required. Hope you have using latest version.
Could you just replace your code
<script type="javascript" src="app.js"></script>
with
<script src="app.js"></script>

Hope this solves your problem.
 
Share this answer
 
Comments
Er. Vikas Sangal 27-Oct-15 1:59am    
why it is so... any specific reason becoze by default script type is javascript.
Kumarbs 3-Nov-15 2:26am    
The MIME type for JavaScript is application/javascript (or the legacy text/javascript). Browsers do not recognise the non-standard javascript MIME type so will ignore the script.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900