Html 如何在默认情况下将复选框设置为true
html:Html 如何在默认情况下将复选框设置为true,html,angularjs,Html,Angularjs,html: <div class="col-lg-2 col-sm-2 col-md-2 col-xs-2"> <input type="checkbox" ng-model="selectedRecord.extendLiveData" > </div> $scope.selectedRecord.extendLiveData = true; 希望将复选框默认设置为true。怎样?如果未选中ng,ng更改您可以通过以下方式通过HTML进行更改:
<div class="col-lg-2 col-sm-2 col-md-2 col-xs-2">
<input type="checkbox" ng-model="selectedRecord.extendLiveData" >
</div>
$scope.selectedRecord.extendLiveData = true;
希望将复选框默认设置为true。怎样?如果未选中
ng
,ng更改
您可以通过以下方式通过HTML进行更改:
$scope.selectedRecord.extendLiveData = true;
<input type="checkbox" ng-model="selectedRecord.extendLiveData" checked>
您可以通过HTML这样做:
$scope.selectedRecord.extendLiveData = true;
<input type="checkbox" ng-model="selectedRecord.extendLiveData" checked>
只需初始化
$scope。selectedRecord
作为对象
$scope.selectedRecord.extendLiveData = true;
$scope.selectedRecord = {};
$scope.selectedRecord.extendLiveData = true;
角度模块(“应用程序”,[])
.controller(“ctrl”,函数($scope){
$scope.selectedRecord={};
$scope.selectedRecord.extendLiveData=true;
})
框值{{selectedRecord.extendLiveData}
只需初始化$scope。selectedRecord
作为对象
$scope.selectedRecord.extendLiveData = true;
$scope.selectedRecord = {};
$scope.selectedRecord.extendLiveData = true;
角度模块(“应用程序”,[])
.controller(“ctrl”,函数($scope){
$scope.selectedRecord={};
$scope.selectedRecord.extendLiveData=true;
})
框值{{selectedRecord.extendLiveData}
只需在输入标记中输入“checked”。比如:
$scope.selectedRecord.extendLiveData = true;
<input type="checkbox" ng-model="selectedRecord.extendLiveData" checked>
只需在输入标记中输入“checked”。比如:
$scope.selectedRecord.extendLiveData = true;
<input type="checkbox" ng-model="selectedRecord.extendLiveData" checked>
创建
selectedRecord
对象,该对象具有extendedlivedata
字段的真值
$scope.selectedRecord.extendLiveData = true;
var-app=angular.module('myApp',[]);
app.controller('chkboxCtrl',函数($scope,$http){
$scope.selectedRecord={extendLiveData:true}
});代码>
默认选中复选框
创建selectedRecord
对象,该对象具有extendedlivedata
字段的真值
$scope.selectedRecord.extendLiveData = true;
var-app=angular.module('myApp',[]);
app.controller('chkboxCtrl',函数($scope,$http){
$scope.selectedRecord={extendLiveData:true}
});代码>
默认选中复选框
您的复选框是否在ng repeat内?您的复选框是否在ng repeat内?