angular.js:38Uncaught错误:[$ injector:modulerr]

问题描述:

下面是代码,我已经包括角度文件,甚至角度路由,但它仍然给出相同的错误。我正在尝试一个非常简单的角码,它仍然给我这个错误,有人可以告诉我我在哪里错了。谢谢。

<title>Login</title> 
<div></div> 
<div class="middle-box text-center loginscreen animated fadeInDown"> 
<div> 
<div></div> 
<h3>Welcome to Login</h3> 
</div> 
<div ng-app="myApp" ng-controller="LoginCtrl"> 
<a ng-show="failedattempt"> 
    <small>Wrong username or password</small></a> 
<form role="form" class="m-t"> 
    <div class="form-group"> 
    <!--input(type='hidden', name='_csrf', value='<%= csrfToken %>')--> 
    <input type="email" placeholder="Username" ng-model="user.username" required="true" class="form-control"/> 
    </div> 
    <div class="form-group"> 
    <input type="password" placeholder="Password" ng-model="user.password" required="true" class="form-control"/> 
    </div> 
    <button type="submit" id="submit" ng-click="submit()" class="btn btn-primary block full-width m-b">Login</button><a href="/login/forgot/"><small>Forgot password?</small></a> 
</form> 
</div> 
</div> 
<script type="text/javascript"> 
var app = angular.module("myApp", ['$scope']); 
app.controller("LoginCtrl", function($scope){ 
var url = "/login/"; 
$scope.failedattempt=false; 
$scope.user = { 
username:"", 
password:"" 
}; 
$scope.submit = function($scope){ 
    $scope.failedattempt = true; 
}}); 
</script> 
+0

您是否在浏览器控制台中看到任何404错误?只是为了确保你有所有必需的文件 –

+0

不,我没有看到任何404,我已经包含了我找到的所有角文件,但它仍然给出了相同的错误。 –

+0

只需将您的代码复制到我的VS并做了F5。我能够看到登录页面没有任何错误。我只包含angular.js文件作为参考.. –

可否请您使用以下定义的应用程序

var app = angular.module("myApp", []); 

没有必要在定义“$范围”。