Hello I am Posting 3rd time my question for checkbox.
Fully code and response on this question which I have posted already.
I have created fiddle of my data.
I am getting broken data please check my fiddle.
请测试我的json可能有问题。 我想使用dietry_reqs数据创建复选框。 http://jsfiddle.net/ashishoft/03L3faq5/2/
Please please help me :(
答案 0 :(得分:0)
首先:你的dietry_reqs是一个不是可迭代对象的字符串:
修正:
"dietry_reqs": [{"id":1,"name":"delhi","value":false},{"id":2,"name":"mumbai","value":false},{"id":3,"name":"ahmedabad","value":false}],
复选框:
<li ng-repeat="(key, value) in thing.dietry_reqs">
<input type="checkbox" ng-model="value.value"> | {{value.name}} => {{value.value}}
</li>
答案 1 :(得分:0)
我认为你正在寻找这样的东西:
var app = angular.module("Demo", []);
app.controller("AppController", function($scope) {
$scope.things = {
"attendance": [{
"id": "14",
"event_booking_id": "32",
"seat_type": "",
"fname": "",
"lname": "",
"email": "",
"company": "",
"dietry_reqs": [{
"id": 1,
"name": "delhi",
"value": true
}, {
"id": 2,
"name": "mumbai",
"value": false
}, {
"id": 3,
"name": "ahmedabad",
"value": false
}],
"attend_status": "0",
"created": "2016-05-05 11:24:56"
}]
}
});
<div ng-app="Demo">
<ul>
<li ng-repeat="a in things.attendance">
<ul>
<li ng-repeat="dr in a.dietry_reqs">
<input type="checkbox" ng-model="dr.value" />{{ dr.name }}
</li>
</ul>
</li>
</ul>
</div>
让我知道。 感谢。