【发布时间】:2016-01-14 07:23:13
【问题描述】:
开关,我想通过 angularjs 控制器动态控制它们的状态。 但它没有按预期工作。
我在下面的 codepen 上复制了这个问题。谁能快速帮忙?
<html ng-app="">
<head >
<!-- Material Design Lite -->
<script src="https://storage.googleapis.com/code.getmdl.io/1.0.5/material.min.js"> </script>
<link rel="stylesheet" href="https://storage.googleapis.com/code.getmdl.io/1.0.5/material.indigo-pink.min.css">
<!-- Material Design icon font -->
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
</head>
<body ng-init="check={}">
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="switch-1">
<input type="checkbox" id="switch-1" class="mdl-switch__input" ng-click="check.set=!check.set" />
<span class="mdl-switch__label"></span>
</label>
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="switch-2">
<input type="checkbox" id="switch-2" class="mdl-switch__input" ng-model="check.set" ng-checked="check.set"/>
<span class="mdl-switch__label"></span>
</label>
{{check.set}}
</body>
</html>
【问题讨论】:
标签: javascript angularjs checkbox material-design