【发布时间】:2016-06-13 17:30:29
【问题描述】:
当页面在两个切换复选框之间加载时,如何默认选中一个复选框。我的代码:
jsfiddle:http://jsfiddle.net/Lvc0u55v/456/
function MyCtrl($scope) {
$scope.changeAxis1 = function() {
if ($scope.thirtyDay) {
$scope.wholeTimeline = false;
}
};
$scope.changeAxis2 = function() {
if($scope.wholeTimeline) {
$scope.thirtyDay = false;
}
};
};
查看
<label class='checkboxes' id='checkbox_1'>
<input type="checkbox" ng-model="thirtyDay" ng-change="changeAxis1()">
Two
</label>
<label class='checkboxes' id='checkbox_2'>
<input type="checkbox" ng-model="wholeTimeline" ng-change="changeAxis2()">
One
</label>
【问题讨论】:
-
设置
model=truefor ex。$scope.thirtyDay = true; -
是的,我已经试过了,它不起作用
标签: javascript jquery angularjs