javascript - AngularJs中复选框和单选框的问题?
PHPz
PHPz 2017-04-10 17:06:57
0
1
163
<label ng-repeat="jtknqk in BM.BM_JTKNQK" style="float: left;">
    <input type="checkbox" name="jtknqk" value="{{jtknqk.name}}"/>
    <span>{{jtknqk.name}}</span>
</label>
其中数据为:
  "BM_JTKNQK":[
    {
      "code": "1",
      "name": "残疾"
    },
    {
      "code": "2",
      "name": "瘫痪"
    },
    {
      "code": "3",
      "name": "重大疾病"
    },
    {
      "code": "4",
      "name": "困难在校生"
    }
  ]
我想要遍历渲染一些checkbox,但是我怎么给每个checkbox赋值ng-model呢?我想要的ng-model格式是ng-model="jtknqk.code"
PHPz
PHPz

学习是最好的投资!

reply all(1)
PHPzhong

直接绑就行了

<input type="checkbox" name="jtknqk" value="{{jtknqk.name}}" ng-model="jtknqk.code"/>    
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template