Home>

Effect picture:

code show as below:

<! Doctype html>
<html ng-app="userinfomodule">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="external nofollow">
<script src="js/angular-1.3.0.js"></script>
</head>
<body>
<div>
 <div>
  <div>
   <div>
    Two-way data binding
   </div>
  </div>
  <div>
   <div>
    <div>
     <form role="form" ng-controller="userinfoctrl">
      <div>
       <label>Email:</label>
       <div>
        <input type="email" placeholder="126 email is recommended" ng-model="userinfo.email">
       </div>
      </div>
      <div>
       <label>password:</label>
       <div>
        <input type="password" placeholder="only numbers, letters, underscore" ng-model="userinfo.password"
       </div>
      </div>
      <div>
       <div>
        <div>
         <label>
          <input type="checkbox" ng-model="userinfo.autologin">automatic login
         </label>
        </div>
       </div>
      </div>
      <div>
       <div>
        <button ng-click="getformdata ()">
         log in
        </button>
       </div>
      </div>
     </form>
    </div>
   </div>
  </div>
 </div>
</div>
</body>
<script>
 var userinfomodule=angular.module ("userinfomodule", []);
userinfomodule.controller ("userinfoctrl", ["$scope", function ($scope) {
 $scope.userinfo={
  email:"[email protected]",  password:"xu201133016",  autologin:true
 };
 $scope.getformdata=function () {
  $scope.userinfo={
  email:"[email protected]",  password:"xu201133016",  autologin:true
  };
 };
 $scope.setformdata=function () {
  $scope.userinfo={
  email:"[email protected]",  password:"xu201133016",  autologin:false
  }
 };
}])
</script>
</html>
  • Previous Example of dynamically adding a scheduled task in java
  • Next Detailed springMVC—three controllers
  • Trends