<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>try</title> <link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet"> <script src="/scripts/jquery.min.js"></script> <script src="/bootstrap/js/bootstrap.min.js"></script> <style type="text/css"> .wrapper{ width: 200px; margin:30px auto; } </style> </head> <body ng-app="" ng-controller="signUpController"> <div class="wrapper"> <form name = "signUpForm" ng-submit="submitForm()"> <h2>sign up register</h2> <div class="form-group"> <label>userName:</label> <input type="text" name="username" class = "form-control" ng-model = "userdata.username" > <p class = "error"></p> </div> <div class="form-group"> <label>password1:</label> <input type="password" name="password1" class = "form-control" ng-model = "userdata.password1" > <p class = "error"></p> </div> <div class="form-group"> <label>password2:</label> <input type="password" name="password2" class="form-control" ng-model = "userdata.password2" > </div> <br> <div class = "form-froup"> <button type = "submit" class = "btn btn-primary">sign up</button> </div> </form> </div> <script> function signUpController($scope){ $scope.userdata = {}; $scope.submitForm = function(){ console.log($scope.userdata); if($scope.signUpForm.$invalid){ alert("confirm the information!"); } else { alert("sign up successed!"); } } } </script> </body> </html>
李晓健
相关分类