【发布时间】:2017-12-12 21:22:08
【问题描述】:
我正在尝试从复选框中获取值,以便我可以绑定它。 但我一直保持条件(真或假)
当我点击复选框时,它会像这样设置我的模型:
[9:真,15:真] 我想要的是一个平面数组,例如:
[9, 15] 有没有更好的方法从复选框中获取值并将它们设置在模型上的数组中?
<ion-checkbox ng-repeat="model in models | filter:query" ng-model="order.models[model.id]" >{{model.model_number}} </ion-checkbox>
</ion-item>
current order: {{order}}
.controller('compareModelsCtrl',['$scope','$http', '$state' ,
function($scope, $http, $state,$location) {
$http.get('js/data.json').success(function(data){
$scope.models = data;
$scope.whichmodel = $state.params.modelId;
//$scope.toggleStar = function(model){
// model.star = !model.star;
//}
$scope.order = {};
【问题讨论】: