1
<html>
<head>
<script type="text/javascript" src="js/angular/angular.js"></script>
<script type="text/javascript" src="js/angular/angular-route.js"></script>
<script type="text/javascript" src="js/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="js/main.js"></script>
<title></title>
<meta name="author" content="Stanislau">
<link href="css/style.css" rel="stylesheet">
</head>
<body ng-app="testApp">
    <div ng-controller="testCtrl">
            {{Message}}
    </div>
</body>
</html>

main.js code

var app = angular.module('testApp', ['ngRoute']);
app.controller('testCtrl', function($scope){
    $scope.Message = '123';
});

Error: angular.js:68 Uncaught Error: [$injector:modulerr] Failed to instantiate module testApp due to: Error: [$injector:nomod] Module 'testApp' 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. http://errors.angularjs.org/1.6.1/$injector/nomod?p0=testApp

if code:

<html>
<head>
<script type="text/javascript" src="js/angular/angular.js"></script>
<script type="text/javascript" src="js/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="js/main.js"></script>
<title></title>
<meta name="author" content="Stanislau">
<link href="css/style.css" rel="stylesheet">
</head>
<body ng-app="testApp">
    <div ng-controller="testCtrl">
            {{Message}}
    </div>
</body>
</html>

main.js code:

var app = angular.module('testApp', []);
app.controller('testCtrl', function($scope){
    $scope.Message = '123';
});

The error is the same!!

Test version address: http://zadanie.salesdep.by/

7
  • It is working in my browser. Can you open the same URL in your browser either by hard reloading or in incognito mode ? Commented Feb 23, 2017 at 12:22
  • works fine in your link Commented Feb 23, 2017 at 12:22
  • 2
    @Afimidas, clear your browser cache Commented Feb 23, 2017 at 12:22
  • What's wrong with my browser! Commented Feb 23, 2017 at 12:24
  • ty guys, incognito mode helped me! Commented Feb 23, 2017 at 12:25

1 Answer 1

0

Code is working fine.Please check the library reference path

<div ng-app="testApp" ng-controller="testCtrl">
<div ng-controller="testCtrl">
            {{Message}}
    </div>
</div>

<script>
var app = angular.module('testApp', []);
app.controller('testCtrl', function($scope){
    $scope.Message = '123';
});
</script>
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.