使用md-switch angular material指令时,不显示切换按钮

时间:2016-11-30 05:32:39

标签: angularjs

//我创建了switchDemo1模块和控制器SwitchDemoCtrl。    //范围数据对象使用初始值定义。

angular.module('switchDemo1', ['ngMaterial'])
.controller('SwitchDemoCtrl', function($scope) {
  $scope.data = {
    cb1: true,
    cb4: true,
    cb5: false
  };

// code in view
    <md-switch ng-model="data.cb1" aria-label="Switch 1">
            Switch 1: {{ data.cb1 }}
    </md-switch>

1 个答案:

答案 0 :(得分:2)

<body ng-controller="SwitchDemoCtrl" layout="row" layout-fill layout-align="space-around center">
  <md-switch ng-model="data.cb1" aria-label="Switch 1">
    Switch 1: {{ data.cb1 }}
  </md-switch>
</body>

<强> DEMO