zoukankan      html  css  js  c++  java
  • angularjs1-4 事件指令

          <div ng-app="myApp">
    
              <div ng-controller="firstController">
                    <div ng-click="run()">点击{{text}}</div>
                    
              </div>
          </div>
          <script type="text/javascript">
              var app = angular.module("myApp", []);
              app.controller('firstController',function($scope){
                    $scope.text='phonegap中文网';
    
                      $scope.run=function(){
    
                          alert('run');
                          console.log('run');
                      }
              });
          </script>
    <!DOCTYPE html>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <title>无标题文档</title>
            <script type="text/javascript" src="angular.min.js"></script>
        </head>
        <body>
          <div ng-app="myApp">
              <div ng-controller="firstController">
                  <input type="checkbox" ng-model="sel">
                  <select>
                      <option>11111</option>
                      <option ng-selected="sel" >22222</option>
                      //select="selected"
                  </select>
                  <input type="checkbox" ng-change="change()" ng-model="c" />
                  {{c}}
                  <br>
                  <input type="text" value="你好" ng-copy="aaa='按下复制键的时候执行的事件'">{{aaa}}
                  <input type="text" value="你好" ng-cut="bbb='按下剪切键的时候执行的事件'">{{bbb}}
                  <input type="text" value="你好" ng-paste="ccc='按下黏贴键的时候执行的事件'">{{ccc}}
                  <br>
                  <br>
                  <div ng-bind="text"></div>
                  <div ng-cloak>{{text}}</div> //防止加载慢出现{{}}
                  <div ng-non-bindable>{{text}}</div>
              </div>
          </div>
          <script type="text/javascript">
              var app = angular.module("myApp", []);
              app.controller('firstController',function($scope){
                  $scope.text='phonegap中文网';
                  $scope.change=function(){
                    if($scope.c==true){
                        alert('选中');
                    }else{
                        alert('未选中');
                    }
                  }
              });
          </script>
        </body>
    </html>
    <!DOCTYPE html>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <title>无标题文档</title>
            <script type="text/javascript" src="angular.min.js"></script>
        </head>
        <body>
          <div ng-app="myApp">
              <div ng-controller="firstController">
                  <input type="button" ng-value="text" ng-disabled="isDisabled">
                  <input type="text" value="{{text}}" ng-readonly="isDisabled">
                  <input type="checkbox" value="{{text}}" ng-checked="isDisabled">
              </div>
          </div>
          <script type="text/javascript">
              var app = angular.module("myApp", []);
              app.controller('firstController',function($scope,$interval){
                    $scope.n=5
                    $scope.text= $scope.n+'';
                    $scope.isDisabled=true;
                   var time=$interval(function(){
                       $scope.n--;
                       $scope.text= $scope.n+'';
                       if($scope.n==0){
                           $interval.cancel(time);;
                           $scope.text='可以点击了';
                           $scope.isDisabled=false;
                       }
                   },1000);
              });
          </script>
        </body>
    </html>
  • 相关阅读:
    【BZOJ 2440】[中山市选2011]完全平方数
    【BZOJ 1066】[SCOI2007]蜥蜴
    luogu P1317 低洼地
    luogu P1379 八数码难题
    luogu P1886 滑动窗口
    luogu P1032 字串变换
    题解 P1876 【开灯】
    题解 P1720 【月落乌啼算钱】
    题解 P2863 【[USACO06JAN]牛的舞会The Cow Prom】
    关于线性回归
  • 原文地址:https://www.cnblogs.com/yaowen/p/7225207.html
Copyright © 2011-2022 走看看