我有一个复选框列表,我在页面启动时以下列方式绑定JSON响应中的值
$scope.LoadScreen = function () {
$http.get('http://xxxxx:0000/education/research').
then(function (response) {
$scope.modelList = response;
}, function (response) {
});
}
<div id="teamCheckboxList" class="checkboxList">
<h3>Select Your Model</h3>
<div ng-repeat="Test in modelList.data | unique : '_source.ModelName'">
<label>
<input type="checkbox" ng-model="modelName.name[Test._source.ModelName]" />
<span>{{Test._source.ModelName}}</span>
</label>
</div>
</div>
点击以下格式的保存按钮
后,我试图将所选值列表存储在复选框中<input type="submit" id="submit" value="Search" ng-click="SaveSearch()" />
$scope.SaveSearch = function () {
$scope.modelName = {
name: []
};
当我尝试打印$ scope.modelName.name时,我得到空数组。我正在寻找帮助以数组格式存储我的复选框选中值。
提前致谢