亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

AngularJS日程表案例詳解

 更新時(shí)間:2017年08月15日 09:21:21   作者:一顆快樂心  
本文通過實(shí)例代碼給大家介紹了AngularJS日程表案例詳解,通過簡單代碼實(shí)現(xiàn)了添加事件/完成事件/刪除事件功能,具體代碼大家參考下本文

功能:添加事件/完成事件/刪除事件

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    *{
      margin: 0;
      padding: 0;
    }
    .note{
      margin:0 auto;
      background: orange;
      color: orange;
      width: 400px;
      padding:2px 2px;
    }
    .input{
      text-align: center;
    }
    h1{
      text-align: center;
      color:#fff;
      padding:10px 10px;
    }
    h5{
      color: #fff;
      text-align: left;
      padding-left: 10px;
    }
    textarea{
      width: 300px;
      height: 58px;
      resize: none;
      border:1px solid orange;
    }
    button{
      width: 80px;
      height: 58px;
      outline: none;
      background: orange;
      font-size: 24px;
      border:3px solid #fff;
      position: relative;
      top:-22px;
      color: #fff;
    }
    ul li{
      margin:0 auto;
      width: 380px;
      background: #fff;
      list-style: none;
      line-height:18px;
      padding:2px;
      margin-bottom:2px;
    }
    .delbtn{
      background: skyblue;
      border:none;
      float: right;
      line-height:14px;
      color: #fff;
      padding:2px 6px;
    }
    .done label{
      text-decoration:line-through ;
    }
  </style>
</head>
<body ng-app="demo">
  <div class="note" ng-controller='democontroller'>
    <h1>NOTE</h1>
    <div class="input">
      <textarea name="" id="" cols="30" rows="10" ng-model="text"></textarea><button ng-click="add()">提交</button>
    </div>
    <div class="todo">
      <h5>未完成:{{todos.length}}</h5>
      <ul>
        <li ng-repeat="todo in todos">
          <form>
            <input type="radio" id="redio" ng-checked="{{todo.checked}}" ng-click="doit($index)">
            <label for="redio">{{todo.text}}</label>
            <input type="button" value="刪除" class="delbtn" ng-click="del($index,todos)">
          </form>
        </li>
      </ul>
    </div>
    <div class="done">
      <h5>已完成:{{dones.length}}</h5>
      <ul>
        <li ng-repeat="done in dones">
          <form>
            <input type="radio" id="redio" ng-checked="{{done.checked}}" ng-click="notdoit($index)">
            <label for="redio">{{done.text}}</label>
            <input type="button" value="刪除" class="delbtn" ng-click="del($index,dones)">
          </form>
        </li>
      </ul>
    </div>
  </div>
  <script src="angular.min.js"></script>
  <script>
    var demo=angular.module('demo',[]);
    demo.controller('democontroller',function($scope){
      $scope.todos=[];
      $scope.dones=[];
      $scope.add=function(){
        $scope.todos.push({
          checked:false,
          text:$scope.text
        });
        $scope.text='';//清空文本框
        console.log($scope.todos.length);
      }
      $scope.doit=function(index){
        var str=$scope.todos.splice(index,1)[0];
        str.checked=true;
        $scope.dones.push(str);
      }
      $scope.notdoit=function(index){
        var str=$scope.dones.splice(index,1)[0];
        str.checked=false;
        $scope.todos.push(str);
      }
      $scope.del=function(index,arr){
        arr.splice(index,1);
      }
    });
  </script>
</body>
</html>

總結(jié)

以上所述是小編給大家介紹的AngularJS日程表案例詳解,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!

相關(guān)文章

  • Commands Queries設(shè)計(jì)模式提高Angular應(yīng)用性能及可維護(hù)性

    Commands Queries設(shè)計(jì)模式提高Angular應(yīng)用性能及可維護(hù)性

    在Angular應(yīng)用開發(fā)領(lǐng)域,Commands and Queries 設(shè)計(jì)模式是一個(gè)關(guān)鍵的概念,它有助于有效地管理應(yīng)用程序的狀態(tài)和與后端的交互,本文將深入探討這一設(shè)計(jì)模式的核心要點(diǎn),并通過實(shí)際示例來加以說明
    2023-10-10
  • Angular管道PIPE的介紹與使用方法

    Angular管道PIPE的介紹與使用方法

    這篇文章主要給大家介紹了關(guān)于Angular管道PIPE的相關(guān)資料,管道的作用就是傳輸,并且不同的管道具有不同的作用,需要的朋友可以參考下
    2021-06-06
  • AngularJS 事件發(fā)布機(jī)制

    AngularJS 事件發(fā)布機(jī)制

    這篇文章主要介紹了AngularJS 事件發(fā)布機(jī)制,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2018-08-08
  • angularjs實(shí)現(xiàn)多張圖片上傳并預(yù)覽功能

    angularjs實(shí)現(xiàn)多張圖片上傳并預(yù)覽功能

    這篇文章主要為大家詳細(xì)介紹了angularjs實(shí)現(xiàn)多張圖片上傳并預(yù)覽功能,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-02-02
  • AngularJs 常用的過濾器

    AngularJs 常用的過濾器

    本篇文章主要介紹了AngularJs常用的過濾器。具有很好的參考價(jià)值。下面跟著小編一起來看下吧
    2017-05-05
  • 在angular 6中使用 less 的實(shí)例代碼

    在angular 6中使用 less 的實(shí)例代碼

    這篇文章主要介紹了在angular 6中使用 less 的實(shí)例代碼,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下
    2018-05-05
  • 淺析Angular 實(shí)現(xiàn)一個(gè)repeat指令的方法

    淺析Angular 實(shí)現(xiàn)一個(gè)repeat指令的方法

    這篇文章主要介紹了Angular 實(shí)現(xiàn)一個(gè)repeat指令的方法,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2019-07-07
  • AngularJS中$http使用的簡單介紹

    AngularJS中$http使用的簡單介紹

    在AngularJS中主要使用$http服務(wù)與遠(yuǎn)程http服務(wù)器交互,本篇文章主要介紹了AngularJS中$http使用的簡單介紹,非常具有實(shí)用價(jià)值,需要的朋友可以參考下。
    2017-03-03
  • 在Angular使用ng-container元素的操作詳解

    在Angular使用ng-container元素的操作詳解

    ng-container 是 Angular 2+ 中可用的一個(gè)元素,可以作為結(jié)構(gòu)指令的宿主,在本文中,您將探討可以使用 ng-container 解決的場景,文中有相關(guān)的代碼示例供大家參考,具有一定的參考價(jià)值,需要的朋友可以參考下
    2024-02-02
  • angular實(shí)現(xiàn)導(dǎo)航菜單切換

    angular實(shí)現(xiàn)導(dǎo)航菜單切換

    這篇文章主要為大家詳細(xì)介紹了angular實(shí)現(xiàn)導(dǎo)航菜單切換,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-03-03

最新評論