Home > front end >  Have any HTML, be able to write an ordinary web page presents js
Have any HTML, be able to write an ordinary web page presents js

Time:09-27

Didn't pay attention to the job a few days ago, now just see, tomorrow will be handed over, under which bosses have to do homework!!!!! ?

CodePudding user response:





<meta charset="utf-8" & gt;
<link rel="stylesheet" href="https://cdn.bootcss.com/twitter-bootstrap/4.4.1/css/bootstrap.css" & gt;
<script SRC="https://cdn.staticfile.org/angular.js/1.4.6/angular.min.js" & gt; </script>
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" & gt;
<script SRC="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js" & gt; </script>
<script SRC="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js" & gt; </script>
<script SRC="https://bbs.csdn.net/topics/base.js" & gt; </script>


<body ng - app="myApp" ng - controller="userCtrl & gt;"



Edit & lt;/th>
Name & lt;/th>
Name & lt;/th>






{{user. FName}} & lt;/td>
{{user. LName}} & lt;/td>














CodePudding user response:

Presents the module (' myApp '[]), the controller (' userCtrl' function ($scope) {
$scope. FName=' ';
$scope. LName=' ';
$scope. Passw1=' ';
$scope. Passw2=' ';
$scope. The users=[
{id: 1, fName: 'the king', lName: "horse"},
{id: 2, fName: 'a', lName: "cui flower"},
{id: 3, fName: 'li', lName: "ya ya"},
{id: 4, fName: 'N', lName: "ick"},
{id: 5, fName: 'a', lName: "dDs"}
];
$scope. Edit=true;
$scope. The error=false;
$scope. Incomplete=false;

{$scope. EditUser=function (id)
If (id=='new') {
$scope. Edit=true;
$scope. Incomplete=true;
$scope. FName=' ';
$scope. LName=' ';
} else {
$scope. Edit=false;
$scope. FName=$scope. The users [id - 1]. FName;
$scope. LName=$scope. The users [id - 1]. LName;
}
};

$scope. $watch (' passw1 ', function () {$scope. The test (); });
$scope. $watch (' passw2 ', function () {$scope. The test (); });
$scope. $watch (' fName ', function () {$scope. The test (); });
$scope. $watch (' lName ', function () {$scope. The test (); });

The=$scope function () {
If ($scope passw1!==$scope. Passw2) {
$scope. The error=true;
} else {
$scope. The error=false;
}
$scope. Incomplete=false;
If ($scope. Edit & amp; & (! $scope. FName. Length | |
! $scope. LName. Length | |
! $scope. Passw1. Length | |! {$scope. Passw2. Length))
$scope. Incomplete=true;
}
};

});
  • Related