0

我必须在 AngularJS 中检查多个复选框的值。我必须在Controller.js中使用该值。我该怎么做?我在 ng-model 中设置了值,但它给出了空数组。

4

1 回答 1

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});

http://plnkr.co/edit/PnABre?p=preview

于 2013-05-07T09:53:00.943 回答