乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      AngularJS學(xué)習(xí)之旅—AngularJS 表單(十六)

       印度阿三17 2019-02-11

      一、AngularJS 表單
        AngularJS 表單是輸入控件的集合。
        HTML 控件
          以下 HTML input 元素被稱為 HTML 控件:
          input 元素
          select 元素
          button 元素
          textarea 元素

      ?

        1、數(shù)據(jù)綁定

      <input type="text" ng-model="firstname">   

          通過以上代碼應(yīng)用有了一個(gè)名為 firstname 的屬性。

          它通過 ng-model 指令來綁定到你的應(yīng)用。

          firstname 屬性可以在 controller 中使用:

      var app = angular.module('myApp', []);
      app.controller('formCtrl', function($scope) {
          $scope.firstname = "John";
      });

          也可以在應(yīng)用的其他地方使用:

      <form>
      First Name: <input type="text" ng-model="firstname">
      </form>
       
      <h1>You entered: {{firstname}}</h1>

        

        2、Checkbox(復(fù)選框)

          checkbox 的值為 true 或 false,可以使用 ng-model 指令綁定,它的值可以用于應(yīng)用中:

      ?

      <form>
          Check to show a header:
          <input type="checkbox" ng-model="myVar">
      </form>
       
      <h1 ng-show="myVar">My Header</h1>

      ?

      ?

        3、單選框 

          我們可以使用 ng-model 來綁定單選按鈕到你的應(yīng)用中。

          單選框使用同一個(gè) ng-model ,可以有不同的值,但只有被選中的單選按鈕的值會被使用。

      <form>
          選擇一個(gè)選項(xiàng):
          <input type="radio" ng-model="myVar" value="dogs">Dogs
          <input type="radio" ng-model="myVar" value="tuts">Tutorials
          <input type="radio" ng-model="myVar" value="cars">Cars
      </form>

      ?

        4、下拉菜單

          使用 ng-model 指令可以將下拉菜單綁定到你的應(yīng)用中。

          ng-model 屬性的值為你在下拉菜單選中的選項(xiàng):

      <form>
      選擇一個(gè)選項(xiàng):
      <select ng-model="myVar">
          <option value="">
          <option value="dogs">Dogs
          <option value="tuts">Tutorials
          <option value="cars">Cars
      </select>
      </form>

      ?

        5、AngularJS 表單實(shí)例

      ?

      <div ng-app="myApp" ng-controller="formCtrl">
        <form novalidate>
          First Name:<br>
          <input type="text" ng-model="user.firstName"><br>
          Last Name:<br>
          <input type="text" ng-model="user.lastName">
          <br><br>
          <button ng-click="reset()">RESET</button>
        </form>
        <p>form = {{user}}</p>
        <p>master = {{master}}</p>
      </div>
       
      <script>
      var app = angular.module('myApp', []);
      app.controller('formCtrl', function($scope) {
          $scope.master = {firstName: "John", lastName: "Doe"};
          $scope.reset = function() {
              $scope.user = angular.copy($scope.master);
          };
          $scope.reset();
      });
      </script>

      ?

      來源:http://www./content-4-112401.html

        本站是提供個(gè)人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多