//我创建了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>
答案 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 强>