我必须在AngularJS中检查多个复选框的值。我必须在 Controller.js 中使用该值。我能为此做些什么? 我在ng-model中设置了值,但它给出了null数组。
答案 0 :(得分:3)
你的模特:
{"cars":
[
{"v":"m","n":"Mini","c":false},
{"v":"c","n":"Corvette","c":true},
{"v":"b","n":"BMW","c":true},
{"v":"l","n":"Lamborghini","c":true},
{"v":"f","n":"Ferrari","c":false}
]
}
您只想检查:
$scope.brands = $filter('filter')($scope.viewModel, {c: true});