How do I bind to list of checkbox values with AngularJS?

前端 未结 29 2643
天涯浪人
天涯浪人 2020-11-22 05:20

I have a few checkboxes:





        
29条回答
  •  遇见更好的自我
    2020-11-22 06:02

    The following solution seems like a good option,

    
    

    And in controller model value fruits will be like this

    $scope.fruits = [
      {
        "name": "apple",
        "checked": true
      },
      {
        "name": "orange"
      },
      {
        "name": "grapes",
        "checked": true
      }
    ];
    

提交回复
热议问题