admin管理员组文章数量:1325236
The markup
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Angular I</title>
<link rel="stylesheet" href="css/style.css">
<link rel="author" href="humans.txt">
</head>
<body ng-app="app">
<section ng-controller="mainCtrl">
<h1>My App</h1>
<p>{{name}}</p>
</section>
<script src=".js/1.5.0-beta.1/angular.min.js"></script>
<script src=".js/1.5.0-beta.1/angular-route.min.js"></script>
<script src=".js/1.5.0-beta.1/angular-animate.min.js"></script>
<script src=".js/1.5.0-beta.1/angular-resource.min.js"></script>
<script src="script.js"></script>
</body>
</html>
The script.js
var app = angular.module('friendsList', []);
app.controller('mainCtrl', function($scope) {
$scope.name = "Leon Gaban";
})
I'm including angular.min, angular-route and even angular-resource and animate...
The markup
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Angular I</title>
<link rel="stylesheet" href="css/style.css">
<link rel="author" href="humans.txt">
</head>
<body ng-app="app">
<section ng-controller="mainCtrl">
<h1>My App</h1>
<p>{{name}}</p>
</section>
<script src="https://cdnjs.cloudflare./ajax/libs/angular.js/1.5.0-beta.1/angular.min.js"></script>
<script src="https://cdnjs.cloudflare./ajax/libs/angular.js/1.5.0-beta.1/angular-route.min.js"></script>
<script src="https://cdnjs.cloudflare./ajax/libs/angular.js/1.5.0-beta.1/angular-animate.min.js"></script>
<script src="https://cdnjs.cloudflare./ajax/libs/angular.js/1.5.0-beta.1/angular-resource.min.js"></script>
<script src="script.js"></script>
</body>
</html>
The script.js
var app = angular.module('friendsList', []);
app.controller('mainCtrl', function($scope) {
$scope.name = "Leon Gaban";
})
I'm including angular.min, angular-route and even angular-resource and animate...
Share Improve this question edited Nov 1, 2015 at 22:52 Pankaj Parkar 136k23 gold badges240 silver badges303 bronze badges asked Nov 1, 2015 at 22:44 Leon GabanLeon Gaban 39.1k122 gold badges349 silver badges550 bronze badges1 Answer
Reset to default 5You had wrong ng-app
module, it should be ng-app="friendsList"
instead of app
.
The error is not due to angular versions, it is because you are injecting wrong dependency in your app mdoule. Simply you can not inject mainCtrl
inside your module as its controller mainCtrl
which you are going to register with your module.
var app = angular.module('friendsList', []);
Also you should have ng-controller="mainCtrl"
on html.
<section ng-controller="mainCtrl">
</section>
本文标签: javascriptWhy am I getting the Angular injectormodulerr error here Using 15 betaStack Overflow
版权声明:本文标题:javascript - Why am I getting the Angular $injector:modulerr error here? Using 1.5 beta - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742168905a2426345.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论