NgSubmit没有工作

时间:2014-05-31 12:14:08

标签: javascript angularjs

我正在使用Laravel作为后端和AngularJS作为前端的Web应用程序。这是我第一次参加AngularJS。这是我的代码

的login.php

<html ng-app="Liquor">
<!--head-->
<body>
    <div class="container">
    <div class="center-block row">
        <div ng-controller="LoginController">
            <form novalidate name="LoginForm" ng-submit="attempt()">
                <div class="form-group">
                    <input type="text" ng-required="true" ng-model="username" name="username" class="form-control"
                           type="text"
                           placeholder="User Name" autofocus="true"/>
                    <input type="password" ng-required="true" name="password" ng-model="password" class="form-control"
                           type="text"
                           placeholder="Password"/>
                    <input type="checkbox" name="rememberme" ng-model="rememberme" />
                    <small>Remember me</small>
                    <br/>
                    <button type="submit" name="submit" class="btn">Login</button>
                </div>
            </form>
        </div>
    </div>
</div>
<script src="js/angular.min.js"></script>
<script src="js/app.js"></script>
<script src="js/controllers/LoginController.js"></script>

app.js

var Liquor = angular.module('Liquor',[]);

LoginController.js

Liquor.controller('LoginController',['$scope',function($scope){
    $scope.attempt = function(){
        alert('test');
    }
}]);

0 个答案:

没有答案