angular의 민감한 글자, 판단이 비어있지 않고 중복 적용되지 않음

16423 단어

<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Titletitle>
    <style>
th,td{
    width: 100px;
    height: 40px;
    border: 1px solid #000000;
}
     /* tr:hover{
          background: #69717d;
      }*/
        table{
            border-collapse: collapse;
            margin-top: 8px;
        }
        .wh{
           width: 20px;
            height: 20px;
        }
        .juli{
            margin-right: 40px;
        }
        .ys{
            background: #0a9dc7;
        }
    style>
    <script src="angular-1.5.5/angular.min.js">script>
    <script>
        /*    */
        var myapp=angular.module("myapp",[]);
        /*       */
        myapp.controller("myCtrl",function ($scope) {
            /*    */
            $scope.items=[
                {
                    "name":"  ",
                    "wz":"   ",
                    "qh":11,
                    "page":555
                },
                {
                    "name":"  ",
                    "wz":"   ",
                    "qh":33,
                    "page":666
                },
                {
                    "name":"  ",
                    "wz":"    ",
                    "qh":55,
                    "page":777
                },
                {
                    "name":"  ",
                    "wz":"   ",
                    "qh":77,
                    "page":888
                },
             {
                 "name":"  ",
                 "wz":"   ",
                 "qh":99,
                 "page":999
             }
            ];
            /*  */
            $scope.pageSize="    ";
            $scope.sort=function(){
                /*  “”    
                    if($scope.pageSize=="    "){
                        $scope.revers=true;
                    }else if($scope.pageSize=="    "){
                        $scope.revers=false;
                    }

            };
            /*     ,    ,    */
         $scope.additem=function () {
            for(var i=0;iif($scope.name==$scope.items[i].name){
                    alert("    ");
                    return;
                }
                if($scope.name==null){
                    alert("    ");
                    return;
                }
            }
            /*      */
            $scope.items.push({"name":$scope.name,"wz":$scope.wz,"qh":$scope.qh,"page":$scope.page});
             /*  */
             $scope.xian=false;
         }
            /*    */
            $scope.xian=false;
            /*  */
            $scope.showall=function () {
                /*  */
                $scope.xian=true;
            }
            /*  ,   */
            /**/
            $scope.chazhao="";
            /**/
            $scope.chazhao2="";
            $scope.$watch("chazhao",function(value){
                if(value.indexOf(" ")!=-1){
                    alert("   ");
                    /**/
                    $scope.chazhao="";
                }else{
                    $scope.chazhao2=$scope.chazhao;
                }
            });
        })

    script>
head>
<body ng-app="myapp" ng-controller="myCtrl">
  :
<input type="text" ng-model="chazhao">
  :
<select ng-model="pageSize" ng-change="sort()">
    <option>    option>
    <option>    option>
     select><br>
<button ng-click="showall()" class="ys">    button><br>
<div ng-show="xian">
  :<input type="text" ng-model="name"><br>
  :<input type="text" ng-model="wz"><br><input type="text" ng-model="qh"><br><input type="text" ng-model="page"><br>
     <button  ng-click="additem()">  button>
div>
table>
<table>
    <tr>
        <th ng-click="sort('name')">  th>
        <th ng-click="sort('wz')">  th>
        <th ng-click="sort('qh')">  th>
        <th ng-click="sort('page')">  th>
    tr>

    <tr ng-repeat="item in items|filter:{name:chazhao2}|orderBy:'page':revers">
        <td>{{item.name}}td>
        <td>{{item.wz}}td>
        <td>{{item.qh}}td>
        <td>{{item.page}}td>
    tr>
table>
body>
html>

좋은 웹페이지 즐겨찾기