【发布时间】:2016-06-21 08:17:39
【问题描述】:
这是我的 json 文件,我想将数据推送到数组 workingSchedules 中的 workingDay(多个数据推送)和 workingHours。
{
"data": {
"id": "string",
"workingSchedules": [
{
"workingDay": "MONDAY",
"workingHours": [
{
"fromTime": 0,
"toTime": 0
}
]
}
],
"twentyFourSevenOpen": false
},
"dataList": [
{
"id": "string",
"workingSchedules": [
{
"workingDay": "MONDAY",
"workingHours": [
{
"fromTime": 0,
"toTime": 0
}
]
}
],
"twentyFourSevenOpen": false
}
]
}
我的代码是这样的
<table class="table table-bordered table-hover">
<tr>
<th class="col-md-4">Day</th>
<th class="col-md-4">From time</th>
<th class="col-md-4">To time</th>
</tr>
<tbody>
<form class="form-horizontal" role="form" ng-repeat="x in something.workingSchedules">
<div class="form-group">
<div class="col-sm-4">
<input style="margin-top:15px" ng-model="x.workingDay" class="form-control input-sm" id="pwd" placeholder="Timings">
</div>
</div>
<form class="form-horizontal" role="form" ng-repeat="x in x.workingHours">
<div class="form-group">
<div class="col-sm-4" >
<input ng-model="x.fromTime" class="form-control input-sm" id="pwd" placeholder="Timings">
</div>
</div>
<div class="form-group">
<div class="col-sm-4">
<input ng-model="x.toTime" class="form-control input-sm" id="pwd" placeholder="Timings">
</div>
</div>
</form>
</form>
</tbody>
这只允许更新单个 workingSchedules 对象,我想要的是首先将数据推送到 UI 中的数组中,然后使用 http post 将其发布到后端 API。
【问题讨论】:
-
你需要为此上传你的js方法
-
欢迎来到stackoverflow。 stackoverflow.com/help/how-to-ask
标签: javascript html arrays angularjs json