Reputation: 777
// i have created switchDemo1 module and controller SwitchDemoCtrl. // scope data object is defined with initial value.
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>
Upvotes: 0
Views: 1098
Reputation: 222720
<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>
Upvotes: 2