2016-04-26 78 views
0

下面是代碼,我已經包括角度文件,甚至角度路由,但它仍然給出相同的錯誤。我正在嘗試一個非常簡單的角碼,它仍然給我這個錯誤,有人可以告訴我我在哪裏錯了。謝謝。

<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文件作爲參考.. –

回答

4

可否請您使用以下定義的應用程序

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

沒有必要在定義「$範圍」。

相關問題