• ionic 单选框操作


    [

    ionic 单选框操作
    实例中,根据选中的不同选项,显示不同的值。

    HTML 代码

    
    <ion-header-bar class="bar-positive">
    
      <h1 class="title">当选按钮</h1>
    
    </ion-header-bar>
    
             
    
    <ion-content>
    
      
    
      <div class="list">
    
        
    
        <div class="item item-divider"> 
    
          选取的值为: {{ data.clientSide }}
    
        </div>
    
        
    
        <ion-radio ng-repeat="item in clientSideList"
    
                   ng-value="item.value"
    
                   ng-model="data.clientSide">
    
          {{ item.text }}
    
        </ion-radio>
    
        
    
        <div class="item item-divider">
    
          Serverside, Selected Value: {{ data.serverSide }}
    
        </div>
    
        
    
        <ion-radio ng-repeat="item in serverSideList"
    
                   ng-value="item.value"
    
                   ng-model="data.serverSide"
    
                   ng-change="serverSideChange(item)"
    
                   name="server-side">
    
          {{ item.text }}
    
        </ion-radio>
    
        
    
      </div>
    
      
    
    </ion-content>
    
    

    JavaScript 代码

    
    angular.module('ionicApp', ['ionic'])
    
    
    
    .controller('MainCtrl', function($scope) {
    
    
    
      $scope.clientSideList = [
    
        { text: "Backbone", value: "bb" },
    
        { text: "Angular", value: "ng" },
    
        { text: "Ember", value: "em" },
    
        { text: "Knockout", value: "ko" }
    
      ];
    
    
    
      $scope.serverSideList = [
    
        { text: "Go", value: "go" },
    
        { text: "Python", value: "py" },
    
        { text: "Ruby", value: "rb" },
    
        { text: "Java", value: "jv" }
    
      ];
    
      
    
      $scope.data = {
    
        clientSide: 'ng'
    
      };
    
      
    
      $scope.serverSideChange = function(item) {
    
        console.log("Selected Serverside, text:", item.text, "value:", item.value);
    
      };
    
      
    
    });
    
    

    css 代码:

    
    body {
    
      cursor: url('https://www.runoob.com/try/demo_source/finger.png'), auto;
    
    }
    
    

    效果如下所示:

    ]
    转载请保留页面地址:https://www.breakyizhan.com/c-3/23497.html
  • 相关阅读:
    JS client(X,Y)、screen(X,Y)、page(X,Y)的区别
    jS冒泡优化
    CSS盒子模型
    CSS段落对齐方式
    CSS引入方式
    CSS/让一个盒子消失的5中方法
    css垂直居中方法
    【数论】BSGS
    【线段树】树套树 树状数组套主席树
    【树】动态树 LCT
  • 原文地址:https://www.cnblogs.com/breakyizhan/p/13286312.html
Copyright © 2020-2023  润新知