search
HomeWeb Front-endJS TutorialValidation function of Angular operation form add, delete, modify and check

This time I will bring you the verification function of adding, deleting, modifying and checking the Angular operation form. What are the precautions for the verification function of adding, deleting, modifying and checking the Angular operation form. The following is a practical case, let’s take a look.

nbsp;html>


  <meta>
  <title>Title</title>
  <style>
    *{
      margin: 0;
      padding: 0;
    }
    .sspan{
      background: #28a54c;
      color: #fff;
      margin-left: 5px;
    }
    th,td{
      border: 1px solid #000;
      padding: 10px;
    }
    table{
      text-align: center;
      width: auto;
      border-collapse: collapse;
    }
    button{
      margin-top: 10px;
      margin-bottom: 10px;
    }
  </style>


  <p>
    <input>
    <input>
    <select>
      <option>选择城市</option>
      <option>北京</option>
      <option>上海</option>
      <option>天津</option>
      <option>重庆</option>
    </select>
    <select>
      <option>选择状态</option>
      <option>发货</option>
      <option>已发货</option>
    </select>
    <select>
      <option>开始月份</option>
      <option>8</option>
      <option>9</option>
      <option>10</option>
    </select>
    -
    <select>
      <option>结束月份</option>
      <option>8</option>
      <option>9</option>
      <option>10</option>
    </select>
  </p>
  <button>新增订单</button>
  <button>批量删除</button>
  
                                                                                                                                                                        
id 商品名用户名手机号价格 城市下单时间 状态
{{$index+1}}{{item.commodity}}{{item.name}}{{item.phone}}{{item.price}}{{item.city}}{{item.order}} {{item.state}} 
  

    

添加

    
      

                  

                       *请输入邮箱 *请输入正确的email地址                    

             

                  

                       *请输入姓名                    

             

                  

                       *密码长度不小于6             *密码长度不超过20                    

             

                  

                       *两次密码输入不一致                    

                  
   <script></script>   <script> var app = angular.module("myapp",[]); app.controller("myCtrl",function ($scope) { $scope.data = [ { commodity:"iPhone4", name:"张三", phone:151111111, price:4999, city:"北京", order:"8-1", state:"发货", done:false }, { commodity:"小米6", name:"李四", phone:15222222, price:2999, city:"北京", order:"8-2", state:"发货", done:false }, { commodity:"华为P9", name:"王五", phone:153333333, price:3999, city:"上海", order:"9-3", state:"已发货", done:false }, { commodity:"OPPO R11", name:"赵六", phone:15444444, price:4999, city:"天津", order:"9-4", state:"已发货", done:false }, { commodity:"ViVo", name:"钱七", phone:155555555, price:2999, city:"重庆", order:"10-4", state:"已发货", done:false } ]; $scope.Choicecity = "选择城市"; $scope.cityFun = function (item) { if($scope.Choicecity != "选择城市"){ if( item.city == $scope.Choicecity){ return true; }else { return false; } }else { return true; } }; $scope.Choicestate = "选择状态"; $scope.stateFun = function (item) { if($scope.Choicestate != "选择状态"){ if(item.state == $scope.Choicestate){ return true; }else { return false; } }else { return true; } }; $scope.pl = "已发货"; $scope.fahuo = function (index) { if($scope.data[index].state=="发货"){ $scope.data[index].state =$scope.pl; } }; $scope.Choiceorder = "开始月份"; $scope.orderFun = function (item) { if($scope.Choiceorder != "开始月份"){ var arr = $scope.order.split("-"); var min = arr[0]; var max = arr[1]; if(item.order >= min){ return false; }else { return true; } }else { return true; } } $scope.quan = function () { if($scope.checkAll == true){ for(var i = 0 ; i <$scope.data.length ; i++){ $scope.data[i].done = true; } }else{ for(var i = 0 ; i <$scope.data.length ; i++){ $scope.data[i].done = false; } } }; $scope.plsc = function () { for(var i = 0 ; i <$scope.data.length ; i++){ if($scope.data[i].done == true){ $scope.data.splice(i,1); i--; } } }; $scope.tj = false; $scope.tianjia = function () { $scope.tj = true; }; $scope.error = false; $scope.tijiaola = function () { if($scope.commoditys==null||$scope.names==null|| $scope.commoditys<6||$scope.commoditys.length>20){ $scope.error = true; } }; $scope.dd = false; $scope.cc = "id"; $scope.sort = function (couldm) { if($scope.cc == couldm ){ $scope.dd =! $scope.dd; } $scope.cc = couldm; } $scope.tianjiapp = function () { $scope.data.push({commodity:$scope.email,name:$scope.name,phone:$scope.password}) } }) </script>

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

How does Yuansheng JS implement asynchronous file upload

Required.js graphic and text explanation

The above is the detailed content of Validation function of Angular operation form add, delete, modify and check. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
聊聊Angular中的元数据(Metadata)和装饰器(Decorator)聊聊Angular中的元数据(Metadata)和装饰器(Decorator)Feb 28, 2022 am 11:10 AM

本篇文章继续Angular的学习,带大家了解一下Angular中的元数据和装饰器,简单了解一下他们的用法,希望对大家有所帮助!

angular学习之详解状态管理器NgRxangular学习之详解状态管理器NgRxMay 25, 2022 am 11:01 AM

本篇文章带大家深入了解一下angular的状态管理器NgRx,介绍一下NgRx的使用方法,希望对大家有所帮助!

浅析angular中怎么使用monaco-editor浅析angular中怎么使用monaco-editorOct 17, 2022 pm 08:04 PM

angular中怎么使用monaco-editor?下面本篇文章记录下最近的一次业务中用到的 monaco-editor 在 angular 中的使用,希望对大家有所帮助!

项目过大怎么办?如何合理拆分Angular项目?项目过大怎么办?如何合理拆分Angular项目?Jul 26, 2022 pm 07:18 PM

Angular项目过大,怎么合理拆分它?下面本篇文章给大家介绍一下合理拆分Angular项目的方法,希望对大家有所帮助!

Angular + NG-ZORRO快速开发一个后台系统Angular + NG-ZORRO快速开发一个后台系统Apr 21, 2022 am 10:45 AM

本篇文章给大家分享一个Angular实战,了解一下angualr 结合 ng-zorro 如何快速开发一个后台系统,希望对大家有所帮助!

聊聊自定义angular-datetime-picker格式的方法聊聊自定义angular-datetime-picker格式的方法Sep 08, 2022 pm 08:29 PM

怎么自定义angular-datetime-picker格式?下面本篇文章聊聊自定义格式的方法,希望对大家有所帮助!

聊聊Angular Route中怎么提前获取数据聊聊Angular Route中怎么提前获取数据Jul 13, 2022 pm 08:00 PM

Angular Route中怎么提前获取数据?下面本篇文章给大家介绍一下从 Angular Route 中提前获取数据的方法,希望对大家有所帮助!

浅析Angular中的独立组件,看看怎么使用浅析Angular中的独立组件,看看怎么使用Jun 23, 2022 pm 03:49 PM

本篇文章带大家了解一下Angular中的独立组件,看看怎么在Angular中创建一个独立组件,怎么在独立组件中导入已有的模块,希望对大家有所帮助!

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft